mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-21 04:07:46 +00:00
Add more error handling in auto login
This commit is contained in:
parent
ed2ea9da33
commit
d39c702d0a
1 changed files with 15 additions and 1 deletions
|
@ -441,7 +441,21 @@ void LauncherCore::login(Profile *profile, const QString &username, const QStrin
|
||||||
|
|
||||||
void LauncherCore::autoLogin(Profile *profile)
|
void LauncherCore::autoLogin(Profile *profile)
|
||||||
{
|
{
|
||||||
login(profile, profile->account()->name(), profile->account()->getPassword(), profile->account()->useOTP() ? profile->account()->getOTP() : QString());
|
QString otp;
|
||||||
|
if (profile->account()->useOTP()) {
|
||||||
|
if (!profile->account()->rememberOTP()) {
|
||||||
|
Q_EMIT loginError("This account does not have an OTP secret set, but requires it for login.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
otp = profile->account()->getOTP();
|
||||||
|
if (otp.isEmpty()) {
|
||||||
|
Q_EMIT loginError("Failed to generate OTP, review the stored secret.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
login(profile, profile->account()->name(), profile->account()->getPassword(), otp);
|
||||||
}
|
}
|
||||||
|
|
||||||
GameInstaller *LauncherCore::createInstaller(Profile *profile)
|
GameInstaller *LauncherCore::createInstaller(Profile *profile)
|
||||||
|
|
Loading…
Add table
Reference in a new issue