Compare commits

...

4 Commits

Author SHA1 Message Date
rdmclin2 146fc587df chore: add eslint-plugin-unicorn 2025-10-23 15:17:49 +07:00
rdmclin2 86c716c7de fix: redirect to login page after logout 2025-10-23 15:17:49 +07:00
rdmclin2 30f059e830 chore: add other account 2025-10-23 15:17:49 +07:00
rdmclin2 33ad680fbb feat: add switch account to oauth page 2025-10-23 15:17:49 +07:00
21 changed files with 38 additions and 1 deletions
+1
View File
@@ -50,6 +50,7 @@
"login": {
"button": "تأكيد تسجيل الدخول",
"description": "التطبيق {{clientName}} يطلب استخدام حسابك لتسجيل الدخول",
"switchAccount": "استخدام حساب آخر",
"title": "تسجيل الدخول إلى {{clientName}}",
"userWelcome": "مرحبًا بعودتك،"
},
+1
View File
@@ -50,6 +50,7 @@
"login": {
"button": "Потвърдете входа",
"description": "Приложение {{clientName}} иска да използва вашия акаунт за вход",
"switchAccount": "Използване на друг акаунт",
"title": "Вход в {{clientName}}",
"userWelcome": "Добре дошли отново, "
},
+1
View File
@@ -50,6 +50,7 @@
"login": {
"button": "Login bestätigen",
"description": "Die Anwendung {{clientName}} beantragt die Nutzung Ihres Kontos für den Login",
"switchAccount": "Anderes Konto verwenden",
"title": "Login bei {{clientName}}",
"userWelcome": "Willkommen zurück, "
},
+1
View File
@@ -50,6 +50,7 @@
"login": {
"button": "Confirm Login",
"description": "The application {{clientName}} is requesting to use your account for login",
"switchAccount": "Use a different account",
"title": "Login to {{clientName}}",
"userWelcome": "Welcome back, "
},
+1
View File
@@ -50,6 +50,7 @@
"login": {
"button": "Confirmar inicio de sesión",
"description": "La aplicación {{clientName}} solicita usar su cuenta para iniciar sesión",
"switchAccount": "Usar otra cuenta",
"title": "Iniciar sesión en {{clientName}}",
"userWelcome": "Bienvenido de nuevo, "
},
+1
View File
@@ -50,6 +50,7 @@
"login": {
"button": "تأیید ورود",
"description": "برنامه {{clientName}} درخواست استفاده از حساب شما برای ورود را دارد",
"switchAccount": "استفاده از حساب دیگر",
"title": "ورود به {{clientName}}",
"userWelcome": "خوش آمدید، دوباره به شما خوش آمد می‌گوییم،"
},
+1
View File
@@ -50,6 +50,7 @@
"login": {
"button": "Confirmer la connexion",
"description": "L'application {{clientName}} demande à utiliser votre compte pour se connecter",
"switchAccount": "Utiliser un autre compte",
"title": "Connexion à {{clientName}}",
"userWelcome": "Bienvenue de nouveau, "
},
+1
View File
@@ -50,6 +50,7 @@
"login": {
"button": "Conferma accesso",
"description": "L'app {{clientName}} richiede di utilizzare il tuo account per accedere",
"switchAccount": "Usa un altro account",
"title": "Accedi a {{clientName}}",
"userWelcome": "Bentornato, "
},
+1
View File
@@ -50,6 +50,7 @@
"login": {
"button": "ログインを確認",
"description": "アプリ {{clientName}} があなたのアカウントを使用してログインすることを要求しています",
"switchAccount": "別のアカウントを使用する",
"title": "{{clientName}} にログイン",
"userWelcome": "お帰りなさい、"
},
+1
View File
@@ -50,6 +50,7 @@
"login": {
"button": "로그인 확인",
"description": "{{clientName}} 애플리케이션이 귀하의 계정으로 로그인하려고 합니다",
"switchAccount": "다른 계정으로 전환",
"title": "{{clientName}} 로그인",
"userWelcome": "다시 오신 것을 환영합니다,"
},
+1
View File
@@ -50,6 +50,7 @@
"login": {
"button": "Bevestig inloggen",
"description": "De applicatie {{clientName}} vraagt om uw account te gebruiken voor inloggen",
"switchAccount": "Een ander account gebruiken",
"title": "Inloggen bij {{clientName}}",
"userWelcome": "Welkom terug, "
},
+1
View File
@@ -50,6 +50,7 @@
"login": {
"button": "Potwierdź logowanie",
"description": "Aplikacja {{clientName}} prosi o użycie Twojego konta do logowania",
"switchAccount": "Użyj innego konta",
"title": "Logowanie do {{clientName}}",
"userWelcome": "Witaj z powrotem, "
},
+1
View File
@@ -50,6 +50,7 @@
"login": {
"button": "Confirmar login",
"description": "O aplicativo {{clientName}} solicita usar sua conta para fazer login",
"switchAccount": "Usar outra conta",
"title": "Login no {{clientName}}",
"userWelcome": "Bem-vindo de volta, "
},
+1
View File
@@ -50,6 +50,7 @@
"login": {
"button": "Подтвердить вход",
"description": "Приложение {{clientName}} запрашивает доступ к вашему аккаунту для входа",
"switchAccount": "Использовать другую учетную запись",
"title": "Вход в {{clientName}}",
"userWelcome": "С возвращением, "
},
+1
View File
@@ -50,6 +50,7 @@
"login": {
"button": "Giriş Yap",
"description": "Uygulama {{clientName}} hesabınızı kullanmak için giriş talep ediyor",
"switchAccount": "Başka bir hesap kullan",
"title": "{{clientName}} Girişi",
"userWelcome": "Hoş geldiniz, "
},
+1
View File
@@ -50,6 +50,7 @@
"login": {
"button": "Xác nhận đăng nhập",
"description": "Ứng dụng {{clientName}} yêu cầu sử dụng tài khoản của bạn để đăng nhập",
"switchAccount": "Sử dụng tài khoản khác",
"title": "Đăng nhập vào {{clientName}}",
"userWelcome": "Chào mừng bạn trở lại, "
},
+1
View File
@@ -50,6 +50,7 @@
"login": {
"button": "确认登录",
"description": "应用 {{clientName}} 申请使用您的账户进行登录",
"switchAccount": "使用其他账户",
"title": "登录 {{clientName}}",
"userWelcome": "欢迎回来,"
},
+1
View File
@@ -50,6 +50,7 @@
"login": {
"button": "確認登入",
"description": "應用 {{clientName}} 申請使用您的帳戶進行登入",
"switchAccount": "使用其他帳戶",
"title": "登入 {{clientName}}",
"userWelcome": "歡迎回來,"
},
+1
View File
@@ -357,6 +357,7 @@
"drizzle-kit": "^0.31.5",
"eslint": "^8.57.1",
"eslint-plugin-mdx": "^3.6.2",
"eslint-plugin-unicorn": "^54.0.0",
"fake-indexeddb": "^6.2.3",
"fs-extra": "^11.3.2",
"glob": "^11.0.3",
@@ -3,7 +3,7 @@
import { Avatar, Button, Text } from '@lobehub/ui';
import { Card, Skeleton } from 'antd';
import { createStyles } from 'antd-style';
import React, { memo } from 'react';
import React, { memo, useCallback, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Center, Flexbox } from 'react-layout-kit';
@@ -52,16 +52,30 @@ const useStyles = createStyles(({ css, token }) => ({
const LoginConfirmClient = memo<LoginConfirmProps>(({ uid, clientMetadata }) => {
const { styles } = useStyles();
const { t } = useTranslation('oauth'); // Assuming translations are in 'oauth'
const [isSwitching, setSwitching] = useState(false);
const clientDisplayName = clientMetadata?.clientName || 'the application';
const isUserStateInit = useUserStore((s) => s.isUserStateInit);
const avatar = useUserStore(userProfileSelectors.userAvatar);
const nickName = useUserStore(userProfileSelectors.nickName);
const [logout, openLogin] = useUserStore((s) => [s.logout, s.openLogin]);
const titleText = t('login.title', { clientName: clientDisplayName });
const descriptionText = t('login.description', { clientName: clientDisplayName });
const buttonText = t('login.button'); // Or "Continue"
const switchButtonText = t('login.switchAccount');
const handleSwitchAccount = useCallback(async () => {
if (isSwitching) return;
try {
setSwitching(true);
await logout();
await openLogin();
} finally {
setSwitching(false);
}
}, [isSwitching, logout, openLogin]);
return (
<Center className={styles.container} gap={16}>
@@ -116,6 +130,9 @@ const LoginConfirmClient = memo<LoginConfirmProps>(({ uid, clientMetadata }) =>
{buttonText}
</Button>
</form>
<Button loading={isSwitching} onClick={handleSwitchAccount} type="text">
{switchButtonText}
</Button>
</Flexbox>
</Flexbox>
</Card>
+1
View File
@@ -51,6 +51,7 @@ const oauth = {
login: {
button: '确认登录',
description: '应用 {{clientName}} 申请使用您的账户进行登录',
switchAccount: '使用其他账户',
title: '登录 {{clientName}}',
userWelcome: '欢迎回来,',
},