mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 09:33:46 +00:00
fix(auth): различать устаревшего бота и ненастроенного на экране логина
This commit is contained in:
@@ -9,6 +9,7 @@ import { useAuthStore } from '../store/auth';
|
||||
import { useNavigate } from 'react-router';
|
||||
import { getPendingCampaignSlug } from '../utils/campaign';
|
||||
import { copyToClipboard } from '../utils/clipboard';
|
||||
import { isEndpointMissingError } from '../utils/api-error';
|
||||
|
||||
interface TelegramLoginButtonProps {
|
||||
referralCode?: string;
|
||||
@@ -159,7 +160,6 @@ export default function TelegramLoginButton({ referralCode }: TelegramLoginButto
|
||||
isOIDC,
|
||||
widgetConfig?.oidc_client_id,
|
||||
widgetConfig?.request_access,
|
||||
t,
|
||||
scriptLoaded,
|
||||
handleScriptFailed,
|
||||
]);
|
||||
@@ -330,8 +330,9 @@ export default function TelegramLoginButton({ referralCode }: TelegramLoginButto
|
||||
},
|
||||
(expires_in || 300) * 1000,
|
||||
);
|
||||
} catch {
|
||||
setDeepLinkError(t('common.error'));
|
||||
} catch (err) {
|
||||
// 404 = the deep-link auth routes don't exist on this bot build (< v3.33.0)
|
||||
setDeepLinkError(t(isEndpointMissingError(err) ? 'auth.botOutdated' : 'common.error'));
|
||||
}
|
||||
}, [botUsername, loginWithDeepLink, navigate, t]);
|
||||
|
||||
@@ -421,9 +422,11 @@ export default function TelegramLoginButton({ referralCode }: TelegramLoginButto
|
||||
}, [deepLinkPolling, deepLinkToken, loginWithDeepLink, navigate, t]);
|
||||
|
||||
if (!botUsername || botUsername === 'your_bot') {
|
||||
// 404 on the config route = the bot build predates the cabinet endpoints,
|
||||
// which reads as "not configured" but is actually a version mismatch (#345).
|
||||
return (
|
||||
<div className="py-4 text-center text-sm text-dark-400">
|
||||
{t('auth.telegramNotConfigured')}
|
||||
{t(widgetConfig?.endpoint_missing ? 'auth.botOutdated' : 'auth.telegramNotConfigured')}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user