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.
This commit is contained in:
Petr Mrázek
2013-12-01 02:00:42 +01:00
parent 2eaf33816b
commit f27a6c39ea
27 changed files with 471 additions and 299 deletions

View File

@ -20,7 +20,7 @@
#include <logger/QsLog.h>
#include <logic/auth/AuthenticateTask.h>
#include <logic/auth/flows/AuthenticateTask.h>
#include <logic/net/NetJob.h>
#include <gui/dialogs/EditAccountDialog.h>
@ -29,9 +29,8 @@
#include <MultiMC.h>
AccountListDialog::AccountListDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::AccountListDialog)
AccountListDialog::AccountListDialog(QWidget *parent)
: QDialog(parent), ui(new Ui::AccountListDialog)
{
ui->setupUi(this);
@ -44,8 +43,8 @@ AccountListDialog::AccountListDialog(QWidget *parent) :
connect(selectionModel, &QItemSelectionModel::selectionChanged,
[this] (const QItemSelection& sel, const QItemSelection& dsel) { updateButtonStates(); });
connect(m_accounts.get(), SIGNAL(listChanged), SLOT(listChanged));
connect(m_accounts.get(), SIGNAL(activeAccountChanged), SLOT(listChanged));
connect(m_accounts.get(), SIGNAL(listChanged()), SLOT(listChanged()));
connect(m_accounts.get(), SIGNAL(activeAccountChanged()), SLOT(listChanged()));
updateButtonStates();
}
@ -60,7 +59,6 @@ void AccountListDialog::listChanged()
updateButtonStates();
}
void AccountListDialog::on_addAccountBtn_clicked()
{
addAccount(tr("Please enter your Mojang or Minecraft account username and password to add your account."));
@ -84,7 +82,7 @@ void AccountListDialog::on_setDefaultBtn_clicked()
QModelIndex selected = selection.first();
MojangAccountPtr account = selected.data(MojangAccountList::PointerRole).value<MojangAccountPtr>();
m_accounts->setActiveAccount(account->username());
}
}
}
void AccountListDialog::on_noDefaultBtn_clicked()
@ -104,7 +102,7 @@ void AccountListDialog::updateButtonStates()
ui->rmAccountBtn->setEnabled(selection.size() > 0);
ui->setDefaultBtn->setEnabled(selection.size() > 0);
ui->noDefaultBtn->setDown(m_accounts->activeAccount().get() == nullptr);
}
@ -146,4 +144,3 @@ void AccountListDialog::addAccount(const QString& errMsg)
}
}
}