feat: add registration invite code handling and improve error translations

- Updated AuthViews component to conditionally show invite code field based on registrationInviteRequired prop.
- Enhanced error handling in auth API functions to use translateServerError for better user feedback.
- Added new translations for various server error messages in English, Spanish, Russian, Chinese (Simplified and Traditional).
- Modified demo initial bootstrap state to include registrationInviteRequired flag.
- Updated types to include registrationInviteRequired in WebBootstrapResponse.
This commit is contained in:
shuaiplus
2026-05-10 23:07:07 +08:00
parent e0d81f2733
commit 7c58282e42
16 changed files with 258 additions and 45 deletions
+29 -1
View File
@@ -349,6 +349,7 @@ const zhCN: Record<string, string> = {
"txt_create": "创建",
"txt_create_account": "创建账户",
"txt_registering": "正在注册...",
"txt_register_failed": "注册失败",
"txt_create_folder": "创建文件夹",
"txt_create_folder_failed": "创建文件夹失败",
"txt_create_item_failed": "创建项目失败",
@@ -408,6 +409,7 @@ const zhCN: Record<string, string> = {
"txt_disable_this_send": "禁用此 Send",
"txt_disable_totp": "停用 TOTP",
"txt_disable_totp_failed": "禁用 TOTP 失败",
"txt_totp_update_failed": "更新 TOTP 失败",
"txt_download": "下载",
"txt_downloading": "下载中...",
"txt_downloading_percent": "下载中 {percent}%",
@@ -467,12 +469,33 @@ const zhCN: Record<string, string> = {
"txt_identity_details": "身份详情",
"txt_ie_browser": "IE 浏览器",
"txt_create_invite_failed": "创建邀请码失败",
"txt_invite_code_optional": "邀请码(首位注册者无需填写,其他人必填)",
"txt_invite_code_required": "邀请码(必填)",
"txt_invite_created": "邀请码已创建",
"txt_invite_revoked": "邀请码已撤销",
"txt_revoke_invite_failed": "撤销邀请码失败",
"txt_invite_validity_hours": "邀请码有效期(小时)",
"txt_invites": "邀请码",
"txt_rate_limit_try_again_seconds": "请求过于频繁,请在 {seconds} 秒后重试",
"txt_server_error_account_disabled": "账号已被禁用",
"txt_server_error_client_credentials_incorrect": "客户端 ID 或客户端密钥不正确,请重试",
"txt_server_error_client_ip_required": "无法获取客户端 IP",
"txt_server_error_email_already_registered": "该邮箱已注册",
"txt_server_error_email_password_required": "邮箱和密码不能为空",
"txt_server_error_email_required": "邮箱不能为空",
"txt_server_error_invalid_refresh_token": "登录状态已失效,请重新登录",
"txt_server_error_invalid_request_payload": "请求内容无效",
"txt_server_error_invite_invalid_or_expired": "邀请码无效或已过期",
"txt_server_error_invite_required": "邀请码不能为空",
"txt_server_error_jwt_secret_default": "JWT_SECRET 正在使用默认示例值,请修改后再继续",
"txt_server_error_jwt_secret_missing": "JWT_SECRET 未设置",
"txt_server_error_jwt_secret_too_short": "JWT_SECRET 至少需要 32 个字符",
"txt_server_error_parameter_error": "请求参数错误",
"txt_server_error_refresh_token_required": "登录状态缺失,请重新登录",
"txt_server_error_registration_retry": "注册暂时不可用,请重试一次",
"txt_server_error_totp_token_required": "请输入两步验证码",
"txt_server_error_two_factor_invalid": "两步验证码无效,请重试",
"txt_server_error_two_factor_required": "需要两步验证",
"txt_server_error_username_password_incorrect": "用户名或密码不正确,请重试",
"txt_ios": "iOS",
"txt_item": "项目",
"txt_item_created": "项目已创建",
@@ -546,6 +569,7 @@ const zhCN: Record<string, string> = {
"txt_master_password_is_required": "主密码不能为空",
"txt_master_password_is_required_2": "请输入主密码",
"txt_master_password_must_be_at_least_12_chars": "主密码至少需要 12 个字符",
"txt_master_password_verify_failed": "主密码验证失败",
"txt_master_password_reprompt": "主密码二次确认",
"txt_master_password_reprompt_2": "主密码二次确认",
"txt_max_access_count": "最大访问次数",
@@ -632,6 +656,9 @@ const zhCN: Record<string, string> = {
"txt_api_key_rotated": "API 密钥已轮换",
"txt_rotate_api_key_confirm": "轮换 API 密钥?当前密钥将立即失效。",
"txt_api_key_is_empty": "API 密钥为空",
"txt_get_api_key_failed": "获取 API 密钥失败",
"txt_get_recovery_code_failed": "获取恢复代码失败",
"txt_rotate_api_key_failed": "轮换 API 密钥失败",
"txt_api_key_dialog_intro": "您的 API 密钥可用于在 Bitwarden CLI 中进行身份验证。",
"txt_api_key_warning_body": "您的 API 密钥是一种替代身份验证机制。请严格保密。",
"txt_oauth_client_credentials": "OAuth 2.0 客户端凭据",
@@ -669,6 +696,7 @@ const zhCN: Record<string, string> = {
"txt_save_profile": "保存资料",
"txt_save_profile_failed": "保存资料失败",
"txt_search_sends": "搜索 Send...",
"txt_session_refresh_failed": "会话刷新失败,请重新登录",
"txt_search_your_secure_vault": "搜索你的密码库...",
"txt_clear_search": "清空搜索",
"txt_clear_search_esc": "清空搜索(Esc",