Show errors when logging in in the account dialog.
This commit is contained in:
parent
3051d0d328
commit
77ddf8b5d7
@ -26,7 +26,9 @@
|
||||
#include <gui/dialogs/EditAccountDialog.h>
|
||||
#include <gui/dialogs/ProgressDialog.h>
|
||||
#include <gui/dialogs/AccountSelectDialog.h>
|
||||
#include "CustomMessageBox.h"
|
||||
#include <logic/tasks/Task.h>
|
||||
#include <logic/auth/YggdrasilTask.h>
|
||||
|
||||
#include <MultiMC.h>
|
||||
|
||||
@ -147,5 +149,12 @@ void AccountListDialog::addAccount(const QString& errMsg)
|
||||
|
||||
job->start();
|
||||
}
|
||||
else
|
||||
{
|
||||
auto reason = task->failReason();
|
||||
auto dlg = CustomMessageBox::selectable(this, tr("Login error."), reason, QMessageBox::Critical);
|
||||
dlg->exec();
|
||||
delete dlg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,8 @@ MojangAccountPtr MojangAccount::loadFromJson(const QJsonObject &object)
|
||||
// The JSON object must at least have a username for it to be valid.
|
||||
if (!object.value("username").isString())
|
||||
{
|
||||
QLOG_ERROR() << "Can't load Mojang account info from JSON object. Username field is missing or of the wrong type.";
|
||||
QLOG_ERROR() << "Can't load Mojang account info from JSON object. Username field is "
|
||||
"missing or of the wrong type.";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -43,7 +44,8 @@ MojangAccountPtr MojangAccount::loadFromJson(const QJsonObject &object)
|
||||
QJsonArray profileArray = object.value("profiles").toArray();
|
||||
if (profileArray.size() < 1)
|
||||
{
|
||||
QLOG_ERROR() << "Can't load Mojang account with username \"" << username << "\". No profiles found.";
|
||||
QLOG_ERROR() << "Can't load Mojang account with username \"" << username
|
||||
<< "\". No profiles found.";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -168,7 +170,7 @@ AccountStatus MojangAccount::accountStatus() const
|
||||
return Online;
|
||||
}
|
||||
|
||||
std::shared_ptr<Task> MojangAccount::login(QString password)
|
||||
std::shared_ptr<YggdrasilTask> MojangAccount::login(QString password)
|
||||
{
|
||||
if (m_currentTask)
|
||||
return m_currentTask;
|
||||
|
@ -95,7 +95,7 @@ public: /* manipulation */
|
||||
* Attempt to login. Empty password means we use the token.
|
||||
* If the attempt fails because we already are performing some task, it returns false.
|
||||
*/
|
||||
std::shared_ptr<Task> login(QString password = QString());
|
||||
std::shared_ptr<YggdrasilTask> login(QString password = QString());
|
||||
|
||||
void downgrade()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user