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 en: Record<string, string> = {
"txt_create": "Create",
"txt_create_account": "Create Account",
"txt_registering": "Creating account...",
"txt_register_failed": "Register failed",
"txt_create_folder": "Create Folder",
"txt_create_folder_failed": "Create folder failed",
"txt_create_item_failed": "Create item failed",
@@ -408,6 +409,7 @@ const en: Record<string, string> = {
"txt_disable_this_send": "Disable this send",
"txt_disable_totp": "Disable TOTP",
"txt_disable_totp_failed": "Disable TOTP failed",
"txt_totp_update_failed": "Update TOTP failed",
"txt_download": "Download",
"txt_downloading": "Downloading...",
"txt_downloading_percent": "Downloading {percent}%",
@@ -467,12 +469,33 @@ const en: Record<string, string> = {
"txt_identity_details": "Identity Details",
"txt_ie_browser": "IE Browser",
"txt_create_invite_failed": "Failed to create invite",
"txt_invite_code_optional": "Invite Code (Not required for the first account; required for all others)",
"txt_invite_code_required": "Invite Code (Required)",
"txt_invite_created": "Invite created",
"txt_invite_revoked": "Invite revoked",
"txt_revoke_invite_failed": "Failed to revoke invite",
"txt_invite_validity_hours": "Invite validity (hours)",
"txt_invites": "Invites",
"txt_rate_limit_try_again_seconds": "Too many requests. Try again in {seconds} seconds.",
"txt_server_error_account_disabled": "Account is disabled",
"txt_server_error_client_credentials_incorrect": "Client ID or client secret is incorrect. Try again.",
"txt_server_error_client_ip_required": "Client IP is required",
"txt_server_error_email_already_registered": "Email already registered",
"txt_server_error_email_password_required": "Email and password are required",
"txt_server_error_email_required": "Email is required",
"txt_server_error_invalid_refresh_token": "Session expired. Please sign in again.",
"txt_server_error_invalid_request_payload": "Invalid request payload",
"txt_server_error_invite_invalid_or_expired": "Invite code is invalid or expired",
"txt_server_error_invite_required": "Invite code is required",
"txt_server_error_jwt_secret_default": "JWT_SECRET is using the default/sample value. Please change it.",
"txt_server_error_jwt_secret_missing": "JWT_SECRET is not set",
"txt_server_error_jwt_secret_too_short": "JWT_SECRET must be at least 32 characters",
"txt_server_error_parameter_error": "Parameter error",
"txt_server_error_refresh_token_required": "Session is missing. Please sign in again.",
"txt_server_error_registration_retry": "Registration is temporarily unavailable. Please retry once.",
"txt_server_error_totp_token_required": "Two-step token is required",
"txt_server_error_two_factor_invalid": "Two-step token is invalid. Try again.",
"txt_server_error_two_factor_required": "Two factor required.",
"txt_server_error_username_password_incorrect": "Username or password is incorrect. Try again.",
"txt_ios": "iOS",
"txt_item": "Item",
"txt_item_created": "Item created",
@@ -546,6 +569,7 @@ const en: Record<string, string> = {
"txt_master_password_is_required": "Master password is required",
"txt_master_password_is_required_2": "Master password is required.",
"txt_master_password_must_be_at_least_12_chars": "Master password must be at least 12 chars",
"txt_master_password_verify_failed": "Master password verify failed",
"txt_master_password_reprompt": "Master password reprompt",
"txt_master_password_reprompt_2": "Master Password Reprompt",
"txt_max_access_count": "Max Access Count",
@@ -632,6 +656,9 @@ const en: Record<string, string> = {
"txt_api_key_rotated": "API key rotated",
"txt_rotate_api_key_confirm": "Rotate API key? The current key will stop working immediately.",
"txt_api_key_is_empty": "API key is empty",
"txt_get_api_key_failed": "Failed to get API key",
"txt_get_recovery_code_failed": "Failed to get recovery code",
"txt_rotate_api_key_failed": "Failed to rotate API key",
"txt_api_key_dialog_intro": "Your API key can be used to authenticate with the Bitwarden CLI.",
"txt_api_key_warning_body": "Your API key is an alternative authentication mechanism. Keep it secret.",
"txt_oauth_client_credentials": "OAuth 2.0 Client Credentials",
@@ -669,6 +696,7 @@ const en: Record<string, string> = {
"txt_save_profile": "Save Profile",
"txt_save_profile_failed": "Save profile failed",
"txt_search_sends": "Search sends...",
"txt_session_refresh_failed": "Session refresh failed. Please sign in again.",
"txt_search_your_secure_vault": "Search your secure vault...",
"txt_clear_search": "Clear search",
"txt_clear_search_esc": "Clear search (Esc)",