1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-21 20:27:45 +00:00

Display the actual login error message when a login failure occurs

Apparently Square Enix provides a human-readable error message, so now
we give that out in the message box instead of a generic
"password is incorrect" message we did before.
This commit is contained in:
Joshua Goins 2022-03-16 14:51:16 -04:00
parent 0dd708096f
commit 65d46aa5c9

View file

@ -143,7 +143,15 @@ void SquareLauncher::login(const LoginInformation& info, const QUrl referer) {
registerSession(info);
} else {
auto messageBox = new QMessageBox(QMessageBox::Icon::Critical, "Failed to Login", "Invalid username/password.");
QRegularExpression re(R"lit(window.external.user\("login=auth,ng,err,(?<launchParams>.*)\);)lit");
QRegularExpressionMatch match = re.match(str);
const auto parts = match.captured(1).split(',');
// there's a stray quote at the end of the error string, so let's remove that
QString errorStr = match.captured(1).chopped(1);
auto messageBox = new QMessageBox(QMessageBox::Icon::Critical, "Failed to Login", errorStr);
messageBox->show();
}
});