summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2017-12-03 14:05:35 +0100
committerPetr Mrázek <peterix@gmail.com>2017-12-03 14:05:35 +0100
commit0a56b562864ce56d14a9657681f221e91dfba129 (patch)
tree8e4c2fee83c82df453ecc792f265a14b321481b5 /api
parent30fad998a6795752911e69906f414bd52c6aa2ad (diff)
downloadMultiMC-0a56b562864ce56d14a9657681f221e91dfba129.tar
MultiMC-0a56b562864ce56d14a9657681f221e91dfba129.tar.gz
MultiMC-0a56b562864ce56d14a9657681f221e91dfba129.tar.lz
MultiMC-0a56b562864ce56d14a9657681f221e91dfba129.tar.xz
MultiMC-0a56b562864ce56d14a9657681f221e91dfba129.zip
NOISSUE in offline mode, do not contact the auth server if there is a valid account already
Diffstat (limited to 'api')
-rw-r--r--api/logic/minecraft/auth/MojangAccount.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/api/logic/minecraft/auth/MojangAccount.cpp b/api/logic/minecraft/auth/MojangAccount.cpp
index f4c628a6..08047438 100644
--- a/api/logic/minecraft/auth/MojangAccount.cpp
+++ b/api/logic/minecraft/auth/MojangAccount.cpp
@@ -170,8 +170,7 @@ AccountStatus MojangAccount::accountStatus() const
return Verified;
}
-std::shared_ptr<YggdrasilTask> MojangAccount::login(AuthSessionPtr session,
- QString password)
+std::shared_ptr<YggdrasilTask> MojangAccount::login(AuthSessionPtr session, QString password)
{
Q_ASSERT(m_currentTask.get() == nullptr);
@@ -186,18 +185,28 @@ std::shared_ptr<YggdrasilTask> MojangAccount::login(AuthSessionPtr session,
return nullptr;
}
- if (password.isEmpty())
+ if(accountStatus() == Verified && !session->wants_online)
{
- m_currentTask.reset(new RefreshTask(this));
+ session->status = AuthSession::PlayableOffline;
+ session->auth_server_online = false;
+ fillSession(session);
+ return nullptr;
}
else
{
- m_currentTask.reset(new AuthenticateTask(this, password));
- }
- m_currentTask->assignSession(session);
+ if (password.isEmpty())
+ {
+ m_currentTask.reset(new RefreshTask(this));
+ }
+ else
+ {
+ m_currentTask.reset(new AuthenticateTask(this, password));
+ }
+ m_currentTask->assignSession(session);
- connect(m_currentTask.get(), SIGNAL(succeeded()), SLOT(authSucceeded()));
- connect(m_currentTask.get(), SIGNAL(failed(QString)), SLOT(authFailed(QString)));
+ connect(m_currentTask.get(), SIGNAL(succeeded()), SLOT(authSucceeded()));
+ connect(m_currentTask.get(), SIGNAL(failed(QString)), SLOT(authFailed(QString)));
+ }
return m_currentTask;
}