cleanups
This commit is contained in:
+1
-5
@@ -17,7 +17,6 @@ const QString kAuthServer = QStringLiteral("https://authserver.ely.by");
|
||||
const QString kInjectorManifest = QStringLiteral("https://authlib-injector.yushi.moe/artifact/latest.json");
|
||||
const QString kInjectorFileName = QStringLiteral("authlib-injector.jar");
|
||||
|
||||
// Ely.by отдаёт UUID без дефисов, вручную введённый мог прийти и с ними.
|
||||
QString normalizeUuid(const QString &uuid)
|
||||
{
|
||||
return QString(uuid).remove(u'-');
|
||||
@@ -34,7 +33,7 @@ QString describeElyError(const QJsonObject &response, int status)
|
||||
return Loc::text("auth.error.serverCode").arg(status);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
}
|
||||
|
||||
AuthService::AuthService(QObject *parent)
|
||||
: QObject(parent)
|
||||
@@ -110,7 +109,6 @@ void AuthService::loginElyBy(const QString &login,
|
||||
|
||||
const QString token = clientToken.isEmpty() ? generateClientToken() : clientToken;
|
||||
|
||||
// Токена ещё нет — сразу за паролем.
|
||||
if (accessToken.isEmpty()) {
|
||||
authenticate(login, password, token, std::move(callback));
|
||||
return;
|
||||
@@ -170,7 +168,6 @@ void AuthService::loginElyByWithTotp(const QString &login,
|
||||
const QString &clientToken,
|
||||
Callback callback)
|
||||
{
|
||||
// Ely.by ждёт двухфакторный код прямо в пароле, через двоеточие.
|
||||
authenticate(login,
|
||||
password + u':' + totp,
|
||||
clientToken.isEmpty() ? generateClientToken() : clientToken,
|
||||
@@ -207,7 +204,6 @@ void AuthService::authenticate(const QString &login,
|
||||
|
||||
if (status != 200) {
|
||||
const QString message = describeElyError(response, status);
|
||||
// Единственный случай, когда ошибка лечится вводом кода, а не пароля.
|
||||
result.twoFactorRequired = message.contains(QStringLiteral("two factor"),
|
||||
Qt::CaseInsensitive);
|
||||
result.error = result.twoFactorRequired
|
||||
|
||||
Reference in New Issue
Block a user