1
Fork 0
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:
Joshua Goins 2023-10-06 18:09:50 -04:00
parent ed2ea9da33
commit d39c702d0a

View file

@ -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)