fix: переделал 2FA, теперь должен работать.
This commit is contained in:
@@ -667,9 +667,10 @@ class AccountModule {
|
||||
required String trackId,
|
||||
required String password,
|
||||
String? hint,
|
||||
bool withEmail = true,
|
||||
}) async {
|
||||
_ensureOnline();
|
||||
final capabilities = <int>[0, if (hint != null) 3, 4];
|
||||
final capabilities = <int>[0, if (hint != null) 3, if (withEmail) 4];
|
||||
final payload = <dynamic, dynamic>{
|
||||
'expectedCapabilities': capabilities,
|
||||
'trackId': trackId,
|
||||
@@ -727,7 +728,7 @@ class AccountModule {
|
||||
|
||||
Future<void> check2faPassword(String trackId, String password) async {
|
||||
_ensureOnline();
|
||||
final packet = await _api.sendRequest(Opcode.authLoginCheckPassword, {
|
||||
final packet = await _api.sendRequest(Opcode.authCheckPassword, {
|
||||
'trackId': trackId,
|
||||
'password': password,
|
||||
});
|
||||
@@ -774,31 +775,15 @@ class AccountModule {
|
||||
);
|
||||
}
|
||||
|
||||
Future<ProfileData> update2faEmail({
|
||||
required String trackId,
|
||||
required String email,
|
||||
required String code,
|
||||
}) async {
|
||||
Future<ProfileData> commit2faEmailChange(String trackId) async {
|
||||
_ensureOnline();
|
||||
final verifyPacket = await _api.sendRequest(Opcode.authVerifyEmail, {
|
||||
'trackId': trackId,
|
||||
'email': email,
|
||||
});
|
||||
_checkPacketError(verifyPacket, 'update2faEmail: verify');
|
||||
|
||||
final codePacket = await _api.sendRequest(Opcode.authCheckEmail, {
|
||||
'trackId': trackId,
|
||||
'verifyCode': code,
|
||||
});
|
||||
_checkPacketError(codePacket, 'update2faEmail: code');
|
||||
|
||||
final payload = <dynamic, dynamic>{
|
||||
'expectedCapabilities': [4],
|
||||
'trackId': trackId,
|
||||
};
|
||||
return _processProfileUpdate(
|
||||
_api.sendRequest(Opcode.authSet2fa, payload),
|
||||
'update2faEmail',
|
||||
'commit2faEmailChange',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -405,8 +405,20 @@ class _CodeConfirmationScreenState extends State<CodeConfirmationScreen>
|
||||
),
|
||||
const Spacer(),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
l10n.codeConfirmation2faWarning,
|
||||
style: TextStyle(
|
||||
color: cs.error.withValues(alpha: 0.5),
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w400,
|
||||
height: 1.35,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
FloatingActionButton(
|
||||
onPressed: () {
|
||||
if (_codeController.text.length == 6) _verifyCode();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -42,6 +42,7 @@
|
||||
},
|
||||
"codeResendSms": "Resend code via SMS",
|
||||
"codeError2faMissing": "Error: missing data for 2FA",
|
||||
"codeConfirmation2faWarning": "MAX may require 2FA on your account to sign in. If you didn't receive the code, set up 2FA from a client where you're already signed in.",
|
||||
|
||||
"proxySettingsTitle": "Proxy",
|
||||
"proxyTypeNone": "Disabled",
|
||||
|
||||
@@ -308,6 +308,12 @@ abstract class AppLocalizations {
|
||||
/// **'Error: missing data for 2FA'**
|
||||
String get codeError2faMissing;
|
||||
|
||||
/// No description provided for @codeConfirmation2faWarning.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'MAX may require 2FA on your account to sign in. If you didn\'t receive the code, set up 2FA from a client where you\'re already signed in.'**
|
||||
String get codeConfirmation2faWarning;
|
||||
|
||||
/// No description provided for @proxySettingsTitle.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
|
||||
@@ -117,6 +117,10 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||
@override
|
||||
String get codeError2faMissing => 'Error: missing data for 2FA';
|
||||
|
||||
@override
|
||||
String get codeConfirmation2faWarning =>
|
||||
'MAX may require 2FA on your account to sign in. If you didn\'t receive the code, set up 2FA from a client where you\'re already signed in.';
|
||||
|
||||
@override
|
||||
String get proxySettingsTitle => 'Proxy';
|
||||
|
||||
|
||||
@@ -119,6 +119,10 @@ class AppLocalizationsRu extends AppLocalizations {
|
||||
@override
|
||||
String get codeError2faMissing => 'Ошибка: отсутствуют данные для 2FA';
|
||||
|
||||
@override
|
||||
String get codeConfirmation2faWarning =>
|
||||
'MAX может требовать 2FA на вашем аккаунте для входа. Если вы не получили код — установите 2FA с клиента, на котором вы авторизованы.';
|
||||
|
||||
@override
|
||||
String get proxySettingsTitle => 'Прокси';
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
},
|
||||
"codeResendSms": "Отправить код по SMS",
|
||||
"codeError2faMissing": "Ошибка: отсутствуют данные для 2FA",
|
||||
"codeConfirmation2faWarning": "MAX может требовать 2FA на вашем аккаунте для входа. Если вы не получили код — установите 2FA с клиента, на котором вы авторизованы.",
|
||||
|
||||
"proxySettingsTitle": "Прокси",
|
||||
"proxyTypeNone": "Выключен",
|
||||
|
||||
Reference in New Issue
Block a user