aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft/auth
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2021-11-16 02:21:59 +0100
committerPetr Mrázek <peterix@gmail.com>2021-11-16 02:21:59 +0100
commit6c82883206181eb7bb1504508bb13a205e0ea65e (patch)
treeeb09cd7aa9f7b2f055659bafbfe24f21df48c1d1 /launcher/minecraft/auth
parent25fbeb265a368b16354d5e44887508121766c45a (diff)
downloadPrismLauncher-6c82883206181eb7bb1504508bb13a205e0ea65e.tar.gz
PrismLauncher-6c82883206181eb7bb1504508bb13a205e0ea65e.tar.bz2
PrismLauncher-6c82883206181eb7bb1504508bb13a205e0ea65e.zip
NOISSUE fix account re-adding not updating current account
Diffstat (limited to 'launcher/minecraft/auth')
-rw-r--r--launcher/minecraft/auth/AccountList.cpp5
-rw-r--r--launcher/minecraft/auth/flows/AuthRequest.cpp6
-rw-r--r--launcher/minecraft/auth/flows/AuthRequest.h2
3 files changed, 6 insertions, 7 deletions
diff --git a/launcher/minecraft/auth/AccountList.cpp b/launcher/minecraft/auth/AccountList.cpp
index 4895c39c..5589cfe9 100644
--- a/launcher/minecraft/auth/AccountList.cpp
+++ b/launcher/minecraft/auth/AccountList.cpp
@@ -69,14 +69,17 @@ void AccountList::addAccount(const MinecraftAccountPtr account)
// override/replace existing account with the same profileId
auto existingAccount = findAccountByProfileId(profileId);
if(existingAccount != -1) {
+ MinecraftAccountPtr existingAccountPtr = m_accounts[existingAccount];
m_accounts[existingAccount] = account;
+ if(m_activeAccount == existingAccountPtr) {
+ m_activeAccount = account;
+ }
emit dataChanged(index(existingAccount), index(existingAccount, columnCount(QModelIndex()) - 1));
onListChanged();
return;
}
}
-
// if we don't have this porfileId yet, add the account to the end
int row = m_accounts.count();
beginInsertRows(QModelIndex(), row, row);
diff --git a/launcher/minecraft/auth/flows/AuthRequest.cpp b/launcher/minecraft/auth/flows/AuthRequest.cpp
index 77558fd3..4b3aaa29 100644
--- a/launcher/minecraft/auth/flows/AuthRequest.cpp
+++ b/launcher/minecraft/auth/flows/AuthRequest.cpp
@@ -89,7 +89,7 @@ void AuthRequest::onUploadProgress(qint64 uploaded, qint64 total) {
emit uploadProgress(uploaded, total);
}
-void AuthRequest::setup(const QNetworkRequest &req, QNetworkAccessManager::Operation operation, const QByteArray &verb) {
+void AuthRequest::setup(const QNetworkRequest &req, QNetworkAccessManager::Operation operation) {
request_ = req;
operation_ = operation;
url_ = req.url();
@@ -97,10 +97,6 @@ void AuthRequest::setup(const QNetworkRequest &req, QNetworkAccessManager::Opera
QUrl url = url_;
request_.setUrl(url);
- if (!verb.isEmpty()) {
- request_.setRawHeader(Katabasis::HTTP_HTTP_HEADER, verb);
- }
-
status_ = Requesting;
error_ = QNetworkReply::NoError;
}
diff --git a/launcher/minecraft/auth/flows/AuthRequest.h b/launcher/minecraft/auth/flows/AuthRequest.h
index 6a45a0bd..20f385b3 100644
--- a/launcher/minecraft/auth/flows/AuthRequest.h
+++ b/launcher/minecraft/auth/flows/AuthRequest.h
@@ -48,7 +48,7 @@ protected slots:
void onUploadProgress(qint64 uploaded, qint64 total);
protected:
- void setup(const QNetworkRequest &request, QNetworkAccessManager::Operation operation, const QByteArray &verb = QByteArray());
+ void setup(const QNetworkRequest &request, QNetworkAccessManager::Operation operation);
enum Status {
Idle, Requesting, ReRequesting