summaryrefslogtreecommitdiffstats
path: root/gui/dialogs/AccountListDialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gui/dialogs/AccountListDialog.cpp')
-rw-r--r--gui/dialogs/AccountListDialog.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/gui/dialogs/AccountListDialog.cpp b/gui/dialogs/AccountListDialog.cpp
index f5268b61..8dae5f07 100644
--- a/gui/dialogs/AccountListDialog.cpp
+++ b/gui/dialogs/AccountListDialog.cpp
@@ -20,12 +20,12 @@
#include <logger/QsLog.h>
-#include <logic/auth/flows/AuthenticateTask.h>
#include <logic/net/NetJob.h>
#include <gui/dialogs/EditAccountDialog.h>
#include <gui/dialogs/ProgressDialog.h>
#include <gui/dialogs/AccountSelectDialog.h>
+#include <logic/tasks/Task.h>
#include <MultiMC.h>
@@ -117,24 +117,24 @@ void AccountListDialog::addAccount(const QString& errMsg)
QString username(loginDialog.username());
QString password(loginDialog.password());
- MojangAccountPtr account = MojangAccountPtr(new MojangAccount(username));
-
+ MojangAccountPtr account = MojangAccount::createFromUsername(username);
ProgressDialog progDialog(this);
- AuthenticateTask authTask(account, password, &progDialog);
- if (progDialog.exec(&authTask))
+ auto task = account->login(password);
+ progDialog.exec(task.get());
+ if(task->successful())
{
- // Add the authenticated account to the accounts list.
- MojangAccountPtr account = authTask.getMojangAccount();
m_accounts->addAccount(account);
+ if (m_accounts->count() == 1)
+ m_accounts->setActiveAccount(account->username());
// Grab associated player skins
auto job = new NetJob("Player skins: " + account->username());
for(AccountProfile profile : account->profiles())
{
- auto meta = MMC->metacache()->resolveEntry("skins", profile.name() + ".png");
+ auto meta = MMC->metacache()->resolveEntry("skins", profile.name + ".png");
auto action = CacheDownload::make(
- QUrl("http://skins.minecraft.net/MinecraftSkins/" + profile.name() + ".png"),
+ QUrl("http://skins.minecraft.net/MinecraftSkins/" + profile.name + ".png"),
meta);
job->addNetAction(action);
meta->stale = true;