refactor(auth): consolidate three Telegram entry points into two

- Drop the passive '@bot_username' link (opens the bot chat with no
  auth purpose) for the common case — it's now redundant with the new
  'Login via bot' button, which offers the same open-bot action plus
  QR and actual authentication.
- Keep the referral deep link (bot start=<referral_code>) only when a
  referralCode prop is present — that's a distinct registration flow
  for not-yet-registered users, not a login method.
- Add an 'or' divider between the widget and the manual deep-link
  button so the two remaining options read as equal alternatives
  rather than a stack of similar-looking Telegram links.
- Shorten the deep-link button label to 'Login via bot' — the
  no-phone-number framing is already implied and shown once the flow
  starts.

No changes to the OIDC/widget button logic itself.
This commit is contained in:
Artem (OpenIN)
2026-08-03 18:23:16 +00:00
committed by Artem
parent d03b9bdad7
commit 75424dba47
3 changed files with 23 additions and 17 deletions

View File

@@ -578,33 +578,39 @@ export default function TelegramLoginButton({ referralCode }: TelegramLoginButto
<div ref={containerRef} className="flex justify-center" />
)}
<div className="text-center">
<p className="mb-2 text-xs text-dark-400">{t('auth.orOpenInApp')}</p>
{/* Referral deep link — only relevant for not-yet-registered users who
arrived via a referral link; the bot itself handles registering
them with the code attached. Hidden otherwise to avoid a third,
visually-identical "Telegram" entry point next to the two auth
methods below. */}
{referralCode && (
<a
href={
referralCode
? `https://t.me/${botUsername}?start=${encodeURIComponent(referralCode)}`
: `https://t.me/${botUsername}`
}
href={`https://t.me/${botUsername}?start=${encodeURIComponent(referralCode)}`}
target="_blank"
rel="noopener noreferrer"
className="text-telegram-blue inline-flex items-center text-sm hover:underline"
className="text-telegram-blue inline-flex items-center text-xs hover:underline"
>
<svg className="mr-1 h-4 w-4" viewBox="0 0 24 24" fill="currentColor">
<path d="M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z" />
</svg>
@{botUsername}
{t('auth.orOpenInApp')}&nbsp;@{botUsername}
</a>
)}
<div className="flex w-full max-w-xs items-center gap-3">
<div className="h-px flex-1 bg-dark-700" />
<span className="text-[11px] text-dark-500">{t('common.or')}</span>
<div className="h-px flex-1 bg-dark-700" />
</div>
{/* Manual opt-in: same deep-link flow used as the anti-block fallback,
offered here as an explicit alternative for users who'd rather
confirm in the bot than type a phone number into the widget. */}
offered here as an explicit equal alternative to the widget for
users who'd rather confirm in the bot than type a phone number. */}
<button
type="button"
onClick={() => setManualDeepLink(true)}
className="text-xs text-dark-400 underline decoration-dotted transition-colors hover:text-dark-300"
className="inline-flex items-center gap-2 rounded-lg border border-dark-700 bg-dark-800/50 px-6 py-3 text-sm font-medium text-dark-200 transition-colors hover:border-dark-600 hover:bg-dark-800"
>
<svg className="h-5 w-5 text-telegram-blue" viewBox="0 0 24 24" fill="currentColor">
<path d="M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z" />
</svg>
{t('auth.loginWithBot')}
</button>
</div>

View File

@@ -208,7 +208,7 @@
"loginFailed": "Login Failed",
"telegramWidgetBlocked": "Telegram login widget is unavailable. Use the bot to sign in:",
"deepLinkIntro": "Confirm sign-in right in the bot — no phone number needed:",
"loginWithBot": "Login via bot (no phone number)",
"loginWithBot": "Login via bot",
"backToWidget": "Back to widget login",
"openBotToLogin": "Open bot to sign in",
"waitingForConfirmation": "Waiting for confirmation...",

View File

@@ -211,7 +211,7 @@
"loginFailed": "Ошибка входа",
"telegramWidgetBlocked": "Виджет входа через Telegram недоступен. Войдите через бота:",
"deepLinkIntro": "Подтвердите вход прямо в боте — без ввода номера телефона:",
"loginWithBot": "Войти через бота (без номера телефона)",
"loginWithBot": "Войти через бота",
"backToWidget": "Назад к входу через виджет",
"openBotToLogin": "Открыть бота для входа",
"waitingForConfirmation": "Ожидание подтверждения...",