mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
refs #764, improved JSON response with messages for JSON authentication service
This commit is contained in:
committed by
Roland Winklmeier
parent
67fdfd228a
commit
03b5f9ce2c
@@ -121,15 +121,22 @@ namespace BlackCore
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonObject jsonObj(Json::jsonObjectFromString(json));
|
||||
CAuthenticatedUser user(CAuthenticatedUser::fromDatabaseJson(jsonObj));
|
||||
|
||||
CStatusMessageList msgs;
|
||||
static const CLogCategoryList cats(CLogCategoryList(this).join({ CLogCategory::validation()}));
|
||||
QJsonObject jsonObj(Json::jsonObjectFromString(json));
|
||||
CAuthenticatedUser user = CAuthenticatedUser::fromDatabaseJson(jsonObj.contains("user") ? jsonObj["user"].toObject() : jsonObj);
|
||||
CStatusMessageList msgs;
|
||||
if (jsonObj.contains("messages"))
|
||||
{
|
||||
msgs = CStatusMessageList::fromDatabaseJson(jsonObj["messages"].toArray());
|
||||
msgs.setCategories(cats);
|
||||
}
|
||||
|
||||
if (!user.isAuthenticated() || !user.isValid())
|
||||
{
|
||||
msgs.push_back(CStatusMessage(cats, CStatusMessage::SeverityError, "Cannot login, user or password wrong"));
|
||||
if (!msgs.hasErrorMessages())
|
||||
{
|
||||
msgs.push_back(CStatusMessage(cats, CStatusMessage::SeverityError, "Cannot login, user or password wrong"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -54,6 +54,7 @@ namespace BlackGui
|
||||
connect(ui->pb_Login, &QPushButton::clicked, this, &CDbLoginComponent::ps_onLoginClicked);
|
||||
connect(ui->pb_Logoff, &QPushButton::clicked, this, &CDbLoginComponent::ps_onLogoffClicked);
|
||||
connect(&m_loginService, &CDatabaseAuthenticationService::userAuthenticationFinished, this, &CDbLoginComponent::ps_AuthenticationFinished);
|
||||
connect(ui->le_Password, &QLineEdit::returnPressed, this, &CDbLoginComponent::ps_onLoginClicked);
|
||||
}
|
||||
|
||||
CDbLoginComponent::~CDbLoginComponent()
|
||||
|
||||
Reference in New Issue
Block a user