diff --git a/web/src/components/auth/LoginForm.jsx b/web/src/components/auth/LoginForm.jsx
index 28d58987f271..adfa772ec0d7 100644
--- a/web/src/components/auth/LoginForm.jsx
+++ b/web/src/components/auth/LoginForm.jsx
@@ -750,7 +750,11 @@ const LoginForm = () => {
}}
>
@@ -793,7 +797,7 @@ const LoginForm = () => {
/>
- 两步验证
+ {t('两步验证')}
}
visible={showTwoFA}
diff --git a/web/src/components/auth/RegisterForm.jsx b/web/src/components/auth/RegisterForm.jsx
index 436a7b6b8a19..c1d112729c5d 100644
--- a/web/src/components/auth/RegisterForm.jsx
+++ b/web/src/components/auth/RegisterForm.jsx
@@ -622,7 +622,11 @@ const RegisterForm = () => {
}}
>
diff --git a/web/src/components/auth/TwoFAVerification.jsx b/web/src/components/auth/TwoFAVerification.jsx
index 626de74363be..d926ba91a7ef 100644
--- a/web/src/components/auth/TwoFAVerification.jsx
+++ b/web/src/components/auth/TwoFAVerification.jsx
@@ -26,25 +26,27 @@ import {
Typography,
} from '@douyinfe/semi-ui';
import React, { useState } from 'react';
+import { useTranslation } from 'react-i18next';
const { Title, Text, Paragraph } = Typography;
const TwoFAVerification = ({ onSuccess, onBack, isModal = false }) => {
+ const { t } = useTranslation();
const [loading, setLoading] = useState(false);
const [useBackupCode, setUseBackupCode] = useState(false);
const [verificationCode, setVerificationCode] = useState('');
const handleSubmit = async () => {
if (!verificationCode) {
- showError('请输入验证码');
+ showError(t('请输入验证码'));
return;
}
// Validate code format
if (useBackupCode && verificationCode.length !== 8) {
- showError('备用码必须是8位');
+ showError(t('备用码必须是8位'));
return;
} else if (!useBackupCode && !/^\d{6}$/.test(verificationCode)) {
- showError('验证码必须是6位数字');
+ showError(t('验证码必须是6位数字'));
return;
}
@@ -55,7 +57,7 @@ const TwoFAVerification = ({ onSuccess, onBack, isModal = false }) => {
});
if (res.data.success) {
- showSuccess('登录成功');
+ showSuccess(t('登录成功'));
// 保存用户信息到本地存储
localStorage.setItem('user', JSON.stringify(res.data.data));
if (onSuccess) {
@@ -65,7 +67,7 @@ const TwoFAVerification = ({ onSuccess, onBack, isModal = false }) => {
showError(res.data.message);
}
} catch (error) {
- showError('验证失败,请重试');
+ showError(t('验证失败,请重试'));
} finally {
setLoading(false);
}
@@ -80,15 +82,17 @@ const TwoFAVerification = ({ onSuccess, onBack, isModal = false }) => {
if (isModal) {
return (
-
- 请输入认证器应用显示的验证码完成登录
+
+ {t('请输入认证器应用显示的验证码完成登录')}
{
size='large'
style={{ marginBottom: 16 }}
>
- 验证并登录
+ {t('验证并登录')}
@@ -121,7 +125,7 @@ const TwoFAVerification = ({ onSuccess, onBack, isModal = false }) => {
}}
style={{ marginRight: 16, color: '#1890ff', padding: 0 }}
>
- {useBackupCode ? '使用认证器验证码' : '使用备用码'}
+ {useBackupCode ? t('使用认证器验证码') : t('使用备用码')}
{onBack && (
@@ -131,19 +135,20 @@ const TwoFAVerification = ({ onSuccess, onBack, isModal = false }) => {
onClick={onBack}
style={{ color: '#1890ff', padding: 0 }}
>
- 返回登录
+ {t('返回登录')}
)}
- 提示:
+ {t('提示:')}
- • 验证码每30秒更新一次
+ {t('• 验证码每30秒更新一次')}
- • 如果无法获取验证码,请使用备用码
-
• 每个备用码只能使用一次
+ {t('• 如果无法获取验证码,请使用备用码')}
+
+ {t('• 每个备用码只能使用一次')}
@@ -161,17 +166,19 @@ const TwoFAVerification = ({ onSuccess, onBack, isModal = false }) => {
>