mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-10 19:44:23 +01:00
🔒 feat: Two-Factor Authentication with Backup Codes & QR support (#5685)
* 🔒 feat: add Two-Factor Authentication (2FA) with backup codes & QR support (#5684) * working version for generating TOTP and authenticate. * better looking UI * refactored + better TOTP logic * fixed issue with UI * fixed issue: remove initial setup when closing window before completion. * added: onKeyDown for verify and disable * refactored some code and cleaned it up a bit. * refactored some code and cleaned it up a bit. * refactored some code and cleaned it up a bit. * refactored some code and cleaned it up a bit. * fixed issue after updating to new main branch * updated example * refactored controllers * removed `passport-totp` not used. * update the generateBackupCodes function to generate 10 codes by default: * update the backup codes to an object. * fixed issue with backup codes not working * be able to disable 2FA with backup codes. * removed new env. replaced with JWT_SECRET * ✨ style: improved a11y and style for TwoFactorAuthentication * 🔒 fix: small types checks * ✨ feat: improve 2FA UI components * fix: remove unnecessary console log * add option to disable 2FA with backup codes * - add option to refresh backup codes - (optional) maybe show the user which backup codes have already been used? * removed text to be able to merge the main. * removed eng tx to be able to merge * fix: migrated lang to new format. * feat: rewrote whole 2FA UI + refactored 2FA backend * chore: resolving conflicts * chore: resolving conflicts * fix: missing packages, because of resolving conflicts. * fix: UI issue and improved a11y * fix: 2FA backup code not working * fix: update localization keys for UI consistency * fix: update button label to use localized text * fix: refactor backup codes regeneration and update localization keys * fix: remove outdated translation for shared links management * fix: remove outdated 2FA code prompts from translation.json * fix: add cursor styles for backup codes item based on usage state * fix: resolve conflict issue * fix: resolve conflict issue * fix: resolve conflict issue * fix: missing packages in package-lock.json * fix: add disabled opacity to the verify button in TwoFactorScreen * ⚙ fix: update 2FA logic to rely on backup codes instead of TOTP status * ⚙️ fix: Simplify user retrieval in 2FA logic by removing unnecessary TOTP secret query * ⚙️ test: Add unit tests for TwoFactorAuthController and twoFactorControllers * ⚙️ fix: Ensure backup codes are validated as an array before usage in 2FA components * ⚙️ fix: Update module path mappings in tests to use relative paths * ⚙️ fix: Update moduleNameMapper in jest.config.js to remove the caret from path mapping * ⚙️ refactor: Simplify import paths in TwoFactorAuthController and twoFactorControllers test files * ⚙️ test: Mock twoFactorService methods in twoFactorControllers tests * ⚙️ refactor: Comment out unused imports and mock setups in test files for two-factor authentication * ⚙️ refactor: removed files * refactor: Exclude totpSecret from user data retrieval in AuthController, LoginController, and jwtStrategy * refactor: Consolidate backup code verification to apply DRY and remove default array in user schema * refactor: Enhance two-factor authentication ux/flow with improved error handling and loading state management, prevent redirect to /login --------- Co-authored-by: Marco Beretta <81851188+berry-13@users.noreply.github.com> Co-authored-by: Danny Avila <danny@librechat.ai>
This commit is contained in:
parent
46ceae1a93
commit
f0f09138bd
63 changed files with 1976 additions and 129 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"chat_direction_left_to_right": "something needs to go here. was empty",
|
||||
"chat_direction_right_to_left": "something needs to go here. was empty",
|
||||
"chat_direction_left_to_right": "Chat direction is now left to right",
|
||||
"chat_direction_right_to_left": "Chat direction is now right to left",
|
||||
"com_a11y_ai_composing": "The AI is still composing.",
|
||||
"com_a11y_end": "The AI has finished their reply.",
|
||||
"com_a11y_start": "The AI has started their reply.",
|
||||
|
|
@ -87,6 +87,7 @@
|
|||
"com_auth_email_verification_redirecting": "Redirecting in {{0}} seconds...",
|
||||
"com_auth_email_verification_resend_prompt": "Didn't receive the email?",
|
||||
"com_auth_email_verification_success": "Email verified successfully",
|
||||
"com_auth_email_verifying_ellipsis": "Verifying...",
|
||||
"com_auth_error_create": "There was an error attempting to register your account. Please try again.",
|
||||
"com_auth_error_invalid_reset_token": "This password reset token is no longer valid.",
|
||||
"com_auth_error_login": "Unable to login with the information provided. Please check your credentials and try again.",
|
||||
|
|
@ -184,7 +185,6 @@
|
|||
"com_endpoint_google_temp": "Higher values = more random, while lower values = more focused and deterministic. We recommend altering this or Top P but not both.",
|
||||
"com_endpoint_google_topk": "Top-k changes how the model selects tokens for output. A top-k of 1 means the selected token is the most probable among all tokens in the model's vocabulary (also called greedy decoding), while a top-k of 3 means that the next token is selected from among the 3 most probable tokens (using temperature).",
|
||||
"com_endpoint_google_topp": "Top-p changes how the model selects tokens for output. Tokens are selected from most K (see topK parameter) probable to least until the sum of their probabilities equals the top-p value.",
|
||||
"com_endpoint_import": "Import",
|
||||
"com_endpoint_instructions_assistants": "Override Instructions",
|
||||
"com_endpoint_instructions_assistants_placeholder": "Overrides the instructions of the assistant. This is useful for modifying the behavior on a per-run basis.",
|
||||
"com_endpoint_max_output_tokens": "Max Output Tokens",
|
||||
|
|
@ -263,7 +263,7 @@
|
|||
"com_files_filter": "Filter files...",
|
||||
"com_files_no_results": "No results.",
|
||||
"com_files_number_selected": "{{0}} of {{1}} items(s) selected",
|
||||
"com_files_table": "something needs to go here. was empty",
|
||||
"com_files_table": "Files Table",
|
||||
"com_generated_files": "Generated files:",
|
||||
"com_hide_examples": "Hide Examples",
|
||||
"com_nav_account_settings": "Account Settings",
|
||||
|
|
@ -272,7 +272,6 @@
|
|||
"com_nav_archive_name": "Name",
|
||||
"com_nav_archived_chats": "Archived chats",
|
||||
"com_nav_archived_chats_empty": "You have no archived conversations.",
|
||||
"com_nav_archived_chats_manage": "Manage",
|
||||
"com_nav_at_command": "@-Command",
|
||||
"com_nav_at_command_description": "Toggle command \"@\" for switching endpoints, models, presets, etc.",
|
||||
"com_nav_audio_play_error": "Error playing audio: {{0}}",
|
||||
|
|
@ -396,7 +395,6 @@
|
|||
"com_nav_setting_speech": "Speech",
|
||||
"com_nav_settings": "Settings",
|
||||
"com_nav_shared_links": "Shared links",
|
||||
"com_nav_shared_links_manage": "Manage",
|
||||
"com_nav_show_code": "Always show code when using code interpreter",
|
||||
"com_nav_show_thinking": "Open Thinking Dropdowns by Default",
|
||||
"com_nav_slash_command": "/-Command",
|
||||
|
|
@ -437,6 +435,9 @@
|
|||
"com_sidepanel_parameters": "Parameters",
|
||||
"com_sidepanel_select_agent": "Select an Agent",
|
||||
"com_sidepanel_select_assistant": "Select an Assistant",
|
||||
"com_nav_2fa": "Two-Factor Authentication (2FA)",
|
||||
"com_auth_verify_your_identity": "Verify Your Identity",
|
||||
"com_auth_two_factor": "Check your preferred one-time password application for a code",
|
||||
"com_ui_accept": "I accept",
|
||||
"com_ui_add": "Add",
|
||||
"com_ui_add_model_preset": "Add a model or preset for an additional response",
|
||||
|
|
@ -626,7 +627,7 @@
|
|||
"com_ui_fork_split_target_setting": "Start fork from target message by default",
|
||||
"com_ui_fork_success": "Successfully forked conversation",
|
||||
"com_ui_fork_visible": "Visible messages only",
|
||||
"com_ui_global_group": "something needs to go here. was empty",
|
||||
"com_ui_global_group": "Global Group",
|
||||
"com_ui_go_back": "Go back",
|
||||
"com_ui_go_to_conversation": "Go to conversation",
|
||||
"com_ui_happy_birthday": "It's my 1st birthday!",
|
||||
|
|
@ -634,7 +635,7 @@
|
|||
"com_ui_host": "Host",
|
||||
"com_ui_idea": "Ideas",
|
||||
"com_ui_image_gen": "Image Gen",
|
||||
"com_ui_import_conversation": "Import",
|
||||
"com_ui_import": "Import",
|
||||
"com_ui_import_conversation_error": "There was an error importing your conversations",
|
||||
"com_ui_import_conversation_file_type_error": "Unsupported import type",
|
||||
"com_ui_import_conversation_info": "Import conversations from a JSON file",
|
||||
|
|
@ -670,9 +671,9 @@
|
|||
"com_ui_no_bookmarks": "it seems like you have no bookmarks yet. Click on a chat and add a new one",
|
||||
"com_ui_no_category": "No category",
|
||||
"com_ui_no_changes": "No changes to update",
|
||||
"com_ui_no_data": "something needs to go here. was empty",
|
||||
"com_ui_no_data": "No data",
|
||||
"com_ui_no_terms_content": "No terms and conditions content to display",
|
||||
"com_ui_no_valid_items": "something needs to go here. was empty",
|
||||
"com_ui_no_valid_items": "No valid items",
|
||||
"com_ui_none": "None",
|
||||
"com_ui_none_selected": "None selected",
|
||||
"com_ui_nothing_found": "Nothing found",
|
||||
|
|
@ -795,6 +796,36 @@
|
|||
"com_ui_write": "Writing",
|
||||
"com_ui_yes": "Yes",
|
||||
"com_ui_zoom": "Zoom",
|
||||
"com_ui_secret_key": "Secret Key",
|
||||
"com_ui_2fa_account_security": "Two-factor authentication adds an extra layer of security to your account",
|
||||
"com_ui_2fa_generate_error": "There was an error generating two-factor authentication settings",
|
||||
"com_ui_backup_codes": "Backup Codes",
|
||||
"com_ui_2fa_invalid": "Invalid two-factor authentication code",
|
||||
"com_ui_2fa_setup": "Setup 2FA",
|
||||
"com_ui_2fa_enable": "Enable 2FA",
|
||||
"com_ui_2fa_disable": "Disable 2FA",
|
||||
"com_ui_disabling": "Disabling...",
|
||||
"com_ui_2fa_enabled": "2FA has been enabled",
|
||||
"com_ui_2fa_disabled": "2FA has been disabled",
|
||||
"com_ui_download_backup": "Download Backup Codes",
|
||||
"com_ui_use_backup_code": "Use Backup Code Instead",
|
||||
"com_ui_use_2fa_code": "Use 2FA Code Instead",
|
||||
"com_ui_verify": "Verify",
|
||||
"com_ui_2fa_disable_error": "There was an error disabling two-factor authentication",
|
||||
"com_ui_2fa_verified": "Successfully verified Two-Factor Authentication",
|
||||
"com_ui_generate_backup": "Generate Backup Codes",
|
||||
"com_ui_regenerate_backup": "Regenerate Backup Codes",
|
||||
"com_ui_regenerating": "Regenerating...",
|
||||
"com_ui_used": "Used",
|
||||
"com_ui_not_used": "Not Used",
|
||||
"com_ui_backup_codes_regenerated": "Backup codes have been regenerated successfully",
|
||||
"com_ui_backup_codes_regenerate_error": "There was an error regenerating backup codes",
|
||||
"com_ui_no_backup_codes": "No backup codes available. Please generate new ones",
|
||||
"com_ui_generating": "Generating...",
|
||||
"com_ui_generate_qrcode": "Generate QR Code",
|
||||
"com_ui_complete_setup": "Complete Setup",
|
||||
"com_ui_download_backup_tooltip": "Before you continue, download your backup codes. You will need them to regain access if you lose your authenticator device",
|
||||
"com_ui_show": "Show",
|
||||
"com_user_message": "You",
|
||||
"com_warning_resubmit_unsupported": "Resubmitting the AI message is not supported for this endpoint."
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue