aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft/auth/flows
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2021-08-29 19:58:35 +0200
committerPetr Mrázek <peterix@gmail.com>2021-08-29 19:59:18 +0200
commit7239502675fb68b1a2050c68f483e5d5371114e1 (patch)
tree80f39a62be153e525aeab5e1349960067173bb5f /launcher/minecraft/auth/flows
parent1e1655bc4b2d6fef3bb14736c7f9506fca246876 (diff)
downloadPrismLauncher-7239502675fb68b1a2050c68f483e5d5371114e1.tar.gz
PrismLauncher-7239502675fb68b1a2050c68f483e5d5371114e1.tar.bz2
PrismLauncher-7239502675fb68b1a2050c68f483e5d5371114e1.zip
GH-3392 Add recognition of already migrated Mojang accounts
Diffstat (limited to 'launcher/minecraft/auth/flows')
-rw-r--r--launcher/minecraft/auth/flows/Yggdrasil.cpp43
1 files changed, 27 insertions, 16 deletions
diff --git a/launcher/minecraft/auth/flows/Yggdrasil.cpp b/launcher/minecraft/auth/flows/Yggdrasil.cpp
index 7cea059c..c2935d05 100644
--- a/launcher/minecraft/auth/flows/Yggdrasil.cpp
+++ b/launcher/minecraft/auth/flows/Yggdrasil.cpp
@@ -255,10 +255,17 @@ void Yggdrasil::processReply()
case QNetworkReply::ContentAccessDenied:
case QNetworkReply::ContentOperationNotPermittedError:
break;
+ case QNetworkReply::ContentGoneError: {
+ changeState(
+ STATE_FAILED_GONE,
+ tr("The Mojang account no longer exists. It may have been migrated to a Microsoft account.")
+ );
+ }
default:
- changeState(STATE_FAILED_SOFT,
- tr("Authentication operation failed due to a network error: %1 (%2)")
- .arg(m_netReply->errorString()).arg(m_netReply->error()));
+ changeState(
+ STATE_FAILED_SOFT,
+ tr("Authentication operation failed due to a network error: %1 (%2)").arg(m_netReply->errorString()).arg(m_netReply->error())
+ );
return;
}
@@ -283,10 +290,10 @@ void Yggdrasil::processReply()
}
else
{
- changeState(STATE_FAILED_SOFT, tr("Failed to parse authentication server response "
- "JSON response: %1 at offset %2.")
- .arg(jsonError.errorString())
- .arg(jsonError.offset));
+ changeState(
+ STATE_FAILED_SOFT,
+ tr("Failed to parse authentication server response JSON response: %1 at offset %2.").arg(jsonError.errorString()).arg(jsonError.offset)
+ );
qCritical() << replyData;
}
return;
@@ -301,19 +308,18 @@ void Yggdrasil::processReply()
// We were able to parse the server's response. Woo!
// Call processError. If a subclass has overridden it then they'll handle their
// stuff there.
- qDebug() << "The request failed, but the server gave us an error message. "
- "Processing error.";
+ qDebug() << "The request failed, but the server gave us an error message. Processing error.";
processError(doc.object());
}
else
{
// The server didn't say anything regarding the error. Give the user an unknown
// error.
- qDebug()
- << "The request failed and the server gave no error message. Unknown error.";
- changeState(STATE_FAILED_SOFT,
- tr("An unknown error occurred when trying to communicate with the "
- "authentication server: %1").arg(m_netReply->errorString()));
+ qDebug() << "The request failed and the server gave no error message. Unknown error.";
+ changeState(
+ STATE_FAILED_SOFT,
+ tr("An unknown error occurred when trying to communicate with the authentication server: %1").arg(m_netReply->errorString())
+ );
}
}
@@ -325,8 +331,13 @@ void Yggdrasil::processError(QJsonObject responseData)
if (errorVal.isString() && errorMessageValue.isString())
{
- m_error = std::shared_ptr<Error>(new Error{
- errorVal.toString(""), errorMessageValue.toString(""), causeVal.toString("")});
+ m_error = std::shared_ptr<Error>(
+ new Error {
+ errorVal.toString(""),
+ errorMessageValue.toString(""),
+ causeVal.toString("")
+ }
+ );
changeState(STATE_FAILED_HARD, m_error->m_errorMessageVerbose);
}
else