diff --git a/src/pages/Login.tsx b/src/pages/Login.tsx index 194f88c..6dea259 100644 --- a/src/pages/Login.tsx +++ b/src/pages/Login.tsx @@ -19,9 +19,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' ) @@ -88,12 +85,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 @@ -304,195 +295,176 @@ export default function Login() { ) : ( /* Card */
- {/* Tabs */} - {isEmailAuthEnabled ? ( -
- - -
- ) : ( -
-

Telegram

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

- {t('auth.registerHint')} -

+ {/* Telegram auth — always visible */} +
+

+ {t('auth.registerHint')} +

- {isLoading && isTelegramWebApp ? ( -
-
-

{t('auth.authenticating')}

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

{t('auth.authenticating')}

+
+ ) : ( + + )} +
+ + {/* Email auth — 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' && ( +
+ +
+ )} +
+ )}
)}