Merge pull request #877 from Scrumplex/refactor-offline-accounts
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
#include "minecraft/auth/AuthRequest.h"
|
||||
#include "minecraft/auth/Parsers.h"
|
||||
#include "minecraft/auth/AccountTask.h"
|
||||
#include "net/NetUtils.h"
|
||||
|
||||
LauncherLoginStep::LauncherLoginStep(AccountData* data) : AuthStep(data) {
|
||||
|
||||
@ -58,10 +59,18 @@ void LauncherLoginStep::onRequestDone(
|
||||
#ifndef NDEBUG
|
||||
qDebug() << data;
|
||||
#endif
|
||||
emit finished(
|
||||
AccountTaskState::STATE_FAILED_SOFT,
|
||||
tr("Failed to get Minecraft access token: %1").arg(requestor->errorString_)
|
||||
);
|
||||
if (Net::isApplicationError(error)) {
|
||||
emit finished(
|
||||
AccountTaskState::STATE_FAILED_SOFT,
|
||||
tr("Failed to get Minecraft access token: %1").arg(requestor->errorString_)
|
||||
);
|
||||
}
|
||||
else {
|
||||
emit finished(
|
||||
AccountTaskState::STATE_OFFLINE,
|
||||
tr("Failed to get Minecraft access token: %1").arg(requestor->errorString_)
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "minecraft/auth/AuthRequest.h"
|
||||
#include "minecraft/auth/Parsers.h"
|
||||
#include "net/NetUtils.h"
|
||||
|
||||
MinecraftProfileStep::MinecraftProfileStep(AccountData* data) : AuthStep(data) {
|
||||
|
||||
@ -64,10 +65,18 @@ void MinecraftProfileStep::onRequestDone(
|
||||
qWarning() << " Response:";
|
||||
qWarning() << QString::fromUtf8(data);
|
||||
|
||||
emit finished(
|
||||
AccountTaskState::STATE_FAILED_SOFT,
|
||||
tr("Minecraft Java profile acquisition failed.")
|
||||
);
|
||||
if (Net::isApplicationError(error)) {
|
||||
emit finished(
|
||||
AccountTaskState::STATE_FAILED_SOFT,
|
||||
tr("Minecraft Java profile acquisition failed: %1").arg(requestor->errorString_)
|
||||
);
|
||||
}
|
||||
else {
|
||||
emit finished(
|
||||
AccountTaskState::STATE_OFFLINE,
|
||||
tr("Minecraft Java profile acquisition failed: %1").arg(requestor->errorString_)
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(!Parsers::parseMinecraftProfile(data, m_data->minecraftProfile)) {
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "minecraft/auth/AuthRequest.h"
|
||||
#include "minecraft/auth/Parsers.h"
|
||||
#include "net/NetUtils.h"
|
||||
|
||||
MinecraftProfileStepMojang::MinecraftProfileStepMojang(AccountData* data) : AuthStep(data) {
|
||||
|
||||
@ -67,10 +68,18 @@ void MinecraftProfileStepMojang::onRequestDone(
|
||||
qWarning() << " Response:";
|
||||
qWarning() << QString::fromUtf8(data);
|
||||
|
||||
emit finished(
|
||||
AccountTaskState::STATE_FAILED_SOFT,
|
||||
tr("Minecraft Java profile acquisition failed.")
|
||||
);
|
||||
if (Net::isApplicationError(error)) {
|
||||
emit finished(
|
||||
AccountTaskState::STATE_FAILED_SOFT,
|
||||
tr("Minecraft Java profile acquisition failed: %1").arg(requestor->errorString_)
|
||||
);
|
||||
}
|
||||
else {
|
||||
emit finished(
|
||||
AccountTaskState::STATE_OFFLINE,
|
||||
tr("Minecraft Java profile acquisition failed: %1").arg(requestor->errorString_)
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(!Parsers::parseMinecraftProfileMojang(data, m_data->minecraftProfile)) {
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "minecraft/auth/AuthRequest.h"
|
||||
#include "minecraft/auth/Parsers.h"
|
||||
#include "net/NetUtils.h"
|
||||
|
||||
XboxAuthorizationStep::XboxAuthorizationStep(AccountData* data, Katabasis::Token *token, QString relyingParty, QString authorizationKind):
|
||||
AuthStep(data),
|
||||
@ -62,10 +63,24 @@ void XboxAuthorizationStep::onRequestDone(
|
||||
#endif
|
||||
if (error != QNetworkReply::NoError) {
|
||||
qWarning() << "Reply error:" << error;
|
||||
if(!processSTSError(error, data, headers)) {
|
||||
if (Net::isApplicationError(error)) {
|
||||
if(!processSTSError(error, data, headers)) {
|
||||
emit finished(
|
||||
AccountTaskState::STATE_FAILED_SOFT,
|
||||
tr("Failed to get authorization for %1 services. Error %2.").arg(m_authorizationKind, error)
|
||||
);
|
||||
}
|
||||
else {
|
||||
emit finished(
|
||||
AccountTaskState::STATE_FAILED_SOFT,
|
||||
tr("Unknown STS error for %1 services: %2").arg(m_authorizationKind, requestor->errorString_)
|
||||
);
|
||||
}
|
||||
}
|
||||
else {
|
||||
emit finished(
|
||||
AccountTaskState::STATE_FAILED_SOFT,
|
||||
tr("Failed to get authorization for %1 services. Error %2.").arg(m_authorizationKind, error)
|
||||
AccountTaskState::STATE_OFFLINE,
|
||||
tr("Failed to get authorization for %1 services: %2").arg(m_authorizationKind, requestor->errorString_)
|
||||
);
|
||||
}
|
||||
return;
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "minecraft/auth/AuthRequest.h"
|
||||
#include "minecraft/auth/Parsers.h"
|
||||
#include "net/NetUtils.h"
|
||||
|
||||
XboxProfileStep::XboxProfileStep(AccountData* data) : AuthStep(data) {
|
||||
|
||||
@ -58,10 +59,18 @@ void XboxProfileStep::onRequestDone(
|
||||
#ifndef NDEBUG
|
||||
qDebug() << data;
|
||||
#endif
|
||||
finished(
|
||||
AccountTaskState::STATE_FAILED_SOFT,
|
||||
tr("Failed to retrieve the Xbox profile.")
|
||||
);
|
||||
if (Net::isApplicationError(error)) {
|
||||
emit finished(
|
||||
AccountTaskState::STATE_FAILED_SOFT,
|
||||
tr("Failed to retrieve the Xbox profile: %1").arg(requestor->errorString_)
|
||||
);
|
||||
}
|
||||
else {
|
||||
emit finished(
|
||||
AccountTaskState::STATE_OFFLINE,
|
||||
tr("Failed to retrieve the Xbox profile: %1").arg(requestor->errorString_)
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "minecraft/auth/AuthRequest.h"
|
||||
#include "minecraft/auth/Parsers.h"
|
||||
#include "net/NetUtils.h"
|
||||
|
||||
XboxUserStep::XboxUserStep(AccountData* data) : AuthStep(data) {
|
||||
|
||||
@ -53,7 +54,17 @@ void XboxUserStep::onRequestDone(
|
||||
|
||||
if (error != QNetworkReply::NoError) {
|
||||
qWarning() << "Reply error:" << error;
|
||||
emit finished(AccountTaskState::STATE_FAILED_SOFT, tr("XBox user authentication failed."));
|
||||
if (Net::isApplicationError(error)) {
|
||||
emit finished(AccountTaskState::STATE_FAILED_SOFT,
|
||||
tr("XBox user authentication failed: %1").arg(requestor->errorString_)
|
||||
);
|
||||
}
|
||||
else {
|
||||
emit finished(
|
||||
AccountTaskState::STATE_OFFLINE,
|
||||
tr("XBox user authentication failed: %1").arg(requestor->errorString_)
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user