diff --git a/src/locales/en.json b/src/locales/en.json index 7e26ac3..866d81a 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -69,6 +69,7 @@ "loginWithEmail": "Login with Email", "noAccount": "Don't have an account?", "hasAccount": "Already have an account?", + "or": "or", "registerHint": "To register with email, first log in via Telegram, then link your email in settings.", "telegramRequired": "Telegram authorization required", "telegramNotConfigured": "Telegram bot is not configured", diff --git a/src/locales/fa.json b/src/locales/fa.json index ba8a1ce..b41168f 100644 --- a/src/locales/fa.json +++ b/src/locales/fa.json @@ -64,6 +64,7 @@ "loginWithEmail": "ورود با ایمیل", "noAccount": "حساب کاربری ندارید؟", "hasAccount": "قبلاً حساب دارید؟", + "or": "یا", "registerHint": "برای ثبت نام با ایمیل، ابتدا با تلگرام وارد شوید، سپس ایمیل خود را در تنظیمات متصل کنید.", "telegramRequired": "نیاز به تایید تلگرام", "telegramNotConfigured": "ربات تلگرام پیکربندی نشده", diff --git a/src/locales/ru.json b/src/locales/ru.json index a8eda22..988e3fb 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -69,6 +69,7 @@ "loginWithEmail": "Войти по Email", "noAccount": "Нет аккаунта?", "hasAccount": "Уже есть аккаунт?", + "or": "или", "registerHint": "Для регистрации по email сначала авторизуйтесь через Telegram, затем привяжите email в настройках.", "telegramRequired": "Требуется авторизация через Telegram", "telegramNotConfigured": "Telegram бот не настроен", diff --git a/src/locales/zh.json b/src/locales/zh.json index d8978e5..3442e51 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -65,6 +65,7 @@ "loginWithEmail": "通过邮箱登录", "noAccount": "没有账户?", "hasAccount": "已有账户?", + "or": "或", "registerHint": "要通过邮箱注册,请先通过Telegram登录,然后在设置中绑定邮箱。", "telegramRequired": "需要Telegram授权", "telegramNotConfigured": "Telegram机器人未配置", 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' && ( +
+ +
+ )} +
+ )}
)}