feat: 添加 TOTP 2FA 功能

This commit is contained in:
mofeng-git
2026-07-17 16:34:06 +08:00
parent fdea52d59d
commit 8bd16df6f8
27 changed files with 1505 additions and 54 deletions

View File

@@ -74,6 +74,15 @@ export default {
forgotPassword: 'Forgot password',
forgotPasswordHint:
'Forgot your password? On the host running One-KVM, open a terminal and run one-kvm user set-password, then enter and confirm the new password when prompted.',
totpPrompt: 'Enter the code from your authenticator app',
totpCode: 'Authenticator code',
totpCodePlaceholder: '6-digit code',
enterTotpCode: 'Enter a 6-digit authenticator code',
invalidTotpCode: 'The authenticator code is incorrect',
totpChallengeExpired: 'This login attempt has expired. Enter your password again.',
totpRateLimited: 'Too many incorrect codes. Wait one minute, then sign in again.',
verifyAndLogin: 'Verify and login',
backToPassword: 'Back to password',
},
status: {
connected: 'Connected',
@@ -469,6 +478,29 @@ export default {
newPassword: 'New Password',
usernameDesc: 'Change the console login username',
passwordDesc: 'Change the console login password',
totp: {
title: 'Two-factor authentication',
description: 'Require an authenticator code when signing in to the web console',
serverTime: 'Server time',
localTime: 'Local time',
clockOffset: 'Clock offset: {seconds} seconds',
clockDriftWarning: 'The server and this device differ by at least 30 seconds. Codes may fail until their clocks are corrected.',
enable: 'Enable 2FA',
disable: 'Disable 2FA',
enableTitle: 'Set up two-factor authentication',
disableTitle: 'Disable two-factor authentication',
manualSecret: 'Manual setup key',
secretOneTime: 'This key is shown only during setup. Store it in your authenticator now.',
enterSixDigitCode: 'Enter a 6-digit authenticator code',
currentPasswordIncorrect: 'The current password is incorrect',
invalidCode: 'The authenticator code is incorrect',
enrollmentExpired: 'Setup expired. Enter your password to start again.',
rateLimited: 'Too many incorrect codes. Wait one minute and try again.',
alreadyEnabled: 'Two-factor authentication is already enabled',
notEnabled: 'Two-factor authentication is not enabled',
operationFailed: 'Unable to update two-factor authentication',
loadFailed: 'Unable to load two-factor authentication status',
},
httpPort: 'HTTP Port',
httpsPort: 'HTTPS Port',
bindAddress: 'Bind Address',

View File

@@ -74,6 +74,15 @@ export default {
forgotPassword: '忘记密码',
forgotPasswordHint:
'忘记密码?在运行本服务的设备上打开终端,执行 one-kvm user set-password按提示输入并确认新密码即可重置。',
totpPrompt: '请输入认证器应用中的验证码',
totpCode: '认证器验证码',
totpCodePlaceholder: '6 位验证码',
enterTotpCode: '请输入 6 位认证器验证码',
invalidTotpCode: '认证器验证码错误',
totpChallengeExpired: '本次登录验证已过期,请重新输入密码。',
totpRateLimited: '错误次数过多,请等待一分钟后重新登录。',
verifyAndLogin: '验证并登录',
backToPassword: '返回密码登录',
},
status: {
connected: '已连接',
@@ -468,6 +477,29 @@ export default {
newPassword: '新密码',
usernameDesc: '修改控制台登录用户名',
passwordDesc: '修改控制台登录密码',
totp: {
title: '双重身份验证',
description: '登录 Web 控制台时要求输入认证器验证码',
serverTime: '服务器时间',
localTime: '本地时间',
clockOffset: '时钟偏差:{seconds} 秒',
clockDriftWarning: '服务器与当前设备的时间相差至少 30 秒,校准时钟前验证码可能无法通过。',
enable: '启用 2FA',
disable: '关闭 2FA',
enableTitle: '设置双重身份验证',
disableTitle: '关闭双重身份验证',
manualSecret: '手动设置密钥',
secretOneTime: '此密钥仅在设置期间显示,请立即添加到认证器。',
enterSixDigitCode: '请输入 6 位认证器验证码',
currentPasswordIncorrect: '当前密码错误',
invalidCode: '认证器验证码错误',
enrollmentExpired: '设置已过期,请重新输入密码开始。',
rateLimited: '错误次数过多,请等待一分钟后重试。',
alreadyEnabled: '双重身份验证已经启用',
notEnabled: '双重身份验证尚未启用',
operationFailed: '无法更新双重身份验证',
loadFailed: '无法加载双重身份验证状态',
},
httpPort: 'HTTP 端口',
httpsPort: 'HTTPS 端口',
bindAddress: '绑定地址',