summaryrefslogtreecommitdiffstats
path: root/gui/MainWindow.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-12-01 02:00:42 +0100
committerPetr Mrázek <peterix@gmail.com>2013-12-01 02:00:42 +0100
commitf27a6c39ea796f946893ced1d9f80441ad9aa18c (patch)
treefed31b28bc7752f4fea85aefddfeff62701e13b7 /gui/MainWindow.cpp
parent2eaf33816b0c4f6fd61ea2b086fa1c4f9fcba4c5 (diff)
downloadMultiMC-f27a6c39ea796f946893ced1d9f80441ad9aa18c.tar
MultiMC-f27a6c39ea796f946893ced1d9f80441ad9aa18c.tar.gz
MultiMC-f27a6c39ea796f946893ced1d9f80441ad9aa18c.tar.lz
MultiMC-f27a6c39ea796f946893ced1d9f80441ad9aa18c.tar.xz
MultiMC-f27a6c39ea796f946893ced1d9f80441ad9aa18c.zip
Fix login and startup logging issues
Auth uses the refresh endpoint instead of validate. This means less password entering. Console will now only autoscroll when already scrolled all the way down. Better conformance with the Yggdrasil auth protocol (not complete yet, but Mojang launcher isn't complete either). Fix bug that prevented saving the account data (uninitialized variable). Accounts can now trigger account list saving, this is used for the refresh endpoint.
Diffstat (limited to 'gui/MainWindow.cpp')
-rw-r--r--gui/MainWindow.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/gui/MainWindow.cpp b/gui/MainWindow.cpp
index a3394a82..854091c6 100644
--- a/gui/MainWindow.cpp
+++ b/gui/MainWindow.cpp
@@ -69,8 +69,9 @@
#include "logic/lists/IconList.h"
#include "logic/lists/JavaVersionList.h"
-#include "logic/auth/AuthenticateTask.h"
-#include "logic/auth/ValidateTask.h"
+#include "logic/auth/flows/AuthenticateTask.h"
+#include "logic/auth/flows/RefreshTask.h"
+#include "logic/auth/flows/ValidateTask.h"
#include "logic/BaseInstance.h"
#include "logic/InstanceFactory.h"
@@ -276,7 +277,6 @@ MainWindow::~MainWindow()
delete assets_downloader;
}
-
void MainWindow::repopulateAccountsMenu()
{
accountMenu->clear();
@@ -791,16 +791,16 @@ void MainWindow::doLaunchInst(BaseInstance* instance, MojangAccountPtr account)
{
// We'll need to validate the access token to make sure the account is still logged in.
ProgressDialog progDialog(this);
- ValidateTask validateTask(account, &progDialog);
- progDialog.exec(&validateTask);
-
- if (validateTask.successful())
+ RefreshTask refreshtask(account, &progDialog);
+ progDialog.exec(&refreshtask);
+
+ if (refreshtask.successful())
{
prepareLaunch(m_selectedInstance, account);
}
else
{
- YggdrasilTask::Error* error = validateTask.getError();
+ YggdrasilTask::Error *error = refreshtask.getError();
if (error != nullptr)
{
@@ -812,17 +812,20 @@ void MainWindow::doLaunchInst(BaseInstance* instance, MojangAccountPtr account)
}
else
{
- CustomMessageBox::selectable(this, tr("Access Token Validation Error"),
+ CustomMessageBox::selectable(
+ this, tr("Access Token Validation Error"),
tr("There was an error when trying to validate your access token.\n"
- "Details: %s").arg(error->getDisplayMessage()),
+ "Details: %s").arg(error->getDisplayMessage()),
QMessageBox::Warning, QMessageBox::Ok)->exec();
}
}
else
{
- CustomMessageBox::selectable(this, tr("Access Token Validation Error"),
+ CustomMessageBox::selectable(
+ this, tr("Access Token Validation Error"),
tr("There was an unknown error when trying to validate your access token."
- "The authentication server might be down, or you might not be connected to the Internet."),
+ "The authentication server might be down, or you might not be connected to "
+ "the Internet."),
QMessageBox::Warning, QMessageBox::Ok)->exec();
}
}
@@ -879,10 +882,7 @@ void MainWindow::launchInstance(BaseInstance *instance, MojangAccountPtr account
console = new ConsoleWindow(proc);
connect(console, SIGNAL(isClosing()), this, SLOT(instanceEnded()));
- // I think this will work...
- QString username = account->username();
- QString session_id = account->accessToken();
- proc->setLogin(username, session_id);
+ proc->setLogin(account);
proc->launch();
}