mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 15:15:50 +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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user