From 77f955fc0d78ab699530006e05cf9459d5f43f82 Mon Sep 17 00:00:00 2001 From: Egor Date: Tue, 27 Jan 2026 17:57:45 +0300 Subject: [PATCH] Update Login.tsx --- src/pages/Login.tsx | 312 ++++++++++++++++++++------------------------ 1 file changed, 142 insertions(+), 170 deletions(-) diff --git a/src/pages/Login.tsx b/src/pages/Login.tsx index 06139f2..172ca0f 100644 --- a/src/pages/Login.tsx +++ b/src/pages/Login.tsx @@ -27,9 +27,6 @@ export default function Login() { // Extract referral code from URL const referralCode = searchParams.get('ref') || ''; - const [activeTab, setActiveTab] = useState<'telegram' | 'email'>(() => - referralCode ? 'email' : 'telegram', - ); const [authMode, setAuthMode] = useState<'login' | 'register'>(() => referralCode ? 'register' : 'login', ); @@ -96,12 +93,6 @@ export default function Login() { } }, [referralCode, emailAuthConfig, botUsername]); - // If email auth is disabled but we initially set to email tab, switch back to telegram - useEffect(() => { - if (!isEmailAuthEnabled && activeTab === 'email') { - setActiveTab('telegram'); - } - }, [isEmailAuthEnabled, activeTab]); const appName = branding ? branding.name : import.meta.env.VITE_APP_NAME || 'VPN'; const appLogo = branding?.logo_letter || import.meta.env.VITE_APP_LOGO || 'V'; const logoUrl = branding ? brandingApi.getLogoUrl(branding) : null; @@ -336,194 +327,175 @@ export default function Login() { ) : ( /* Card */
- {/* Tabs */} - {isEmailAuthEnabled ? ( -
- - -
- ) : ( -
-

Telegram

-
- )} - {error && (
{error}
)} - {activeTab === 'telegram' || !isEmailAuthEnabled ? ( -
-

{t('auth.registerHint')}

+ {/* Telegram auth section */} +
+

{t('auth.registerHint')}

- {isLoading && isTelegramWebApp ? ( -
-
-

{t('auth.authenticating')}

-
- ) : ( - - )} -
- ) : ( -
- {/* Login / Register toggle */} -
- - + {isLoading && isTelegramWebApp ? ( +
+
+

{t('auth.authenticating')}

+
+ ) : ( + + )} +
+ + {/* Email auth section - only when enabled */} + {isEmailAuthEnabled && ( + <> + {/* Divider */} +
+
+ {t('auth.or', 'or')} +
-
- {/* First name field - only for registration */} - {authMode === 'register' && ( +
+ {/* Login / Register toggle */} +
+ + +
+ + + {/* First name field - only for registration */} + {authMode === 'register' && ( +
+ + setFirstName(e.target.value)} + /> +
+ )} +
-
- )} -
- - setEmail(e.target.value)} - /> -
- -
- - setPassword(e.target.value)} - /> -
- - {/* Confirm password - only for registration */} - {authMode === 'register' && (
-
+ + {/* Confirm password - only for registration */} + {authMode === 'register' && ( +
+ + setConfirmPassword(e.target.value)} + /> +
+ )} + + + + + {/* Verification notice for registration */} + {authMode === 'register' && ( +

+ {t( + 'auth.verificationEmailNotice', + 'After registration, a verification email will be sent to your address', + )} +

)} - - - - {/* Verification notice for registration */} - {authMode === 'register' && ( -

- {t( - 'auth.verificationEmailNotice', - 'After registration, a verification email will be sent to your address', - )} -

- )} - - {/* Forgot password link - only for login */} - {authMode === 'login' && ( -
- -
- )} -
+ {/* Forgot password link - only for login */} + {authMode === 'login' && ( +
+ +
+ )} +
+ )}
)}