diff --git a/mnemo_cards_web_v2/lib/presentation/pages/auth/sign_in_with_telegram.dart b/mnemo_cards_web_v2/lib/presentation/pages/auth/sign_in_with_telegram.dart index ae0012a..d25f006 100644 --- a/mnemo_cards_web_v2/lib/presentation/pages/auth/sign_in_with_telegram.dart +++ b/mnemo_cards_web_v2/lib/presentation/pages/auth/sign_in_with_telegram.dart @@ -44,8 +44,8 @@ class _SignInWithTelegramState extends State { super.dispose(); } - Future _loginWithTelegram() async { - final code = _telegramCodeController.text.trim(); + Future _loginWithTelegram({String? codeParam}) async { + final code = codeParam ?? _telegramCodeController.text.trim(); if (code.isEmpty) { widget.onError('Введите код авторизации'); @@ -191,15 +191,15 @@ class _SignInWithTelegramState extends State { widget.onError('Срок действия кода истёк. Сгенерируйте новый.'); } else if (status.isConsumed) { _stopCodePolling(); - } else if (status.isReadyForLogin && !_autoLoginAttempted && mounted) { + } else if (status.isReadyForLogin) { log('Auto-login triggered for code: ${status.code}', name: 'SignInWithTelegram'); _autoLoginAttempted = true; // Small delay to ensure UI updates are processed before navigation - await Future.delayed(const Duration(milliseconds: 100)); + // await Future.delayed(const Duration(milliseconds: 100)); if (mounted) { - await _loginWithTelegram(); + await _loginWithTelegram(codeParam: status.code); } } } catch (e, s) {