mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 10:58:17 -05:00
[PR #16461] [CLOSED] feat: Add TOTP 2FA authentication system #24143
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/16461
Author: @jeremy-windsor
Created: 8/10/2025
Status: ❌ Closed
Base:
dev← Head:feature/totp-2fa-integration📝 Commits (4)
0cca3d3feat: Add TOTP 2FA authentication systemf40f9a8fix: add missing @tiptap/suggestion dependency for build8d0451dUpdate TOTP 2FA integration: added admin controlbda05baMerge upstream/dev into feature/totp-2fa-integration📊 Changes
12 files changed (+3935 additions, -6388 deletions)
View changed files
📝
.gitignore(+1 -0)➕
backend/open_webui/migrations/versions/e4f7b8c9d2a1_add_totp_fields_to_user_table.py(+37 -0)📝
backend/open_webui/models/users.py(+9 -1)📝
backend/open_webui/routers/auths.py(+419 -4)📝
backend/open_webui/utils/auth.py(+139 -0)📝
package-lock.json(+1997 -5859)📝
package.json(+2 -0)📝
src/lib/apis/auths/index.ts(+230 -0)📝
src/lib/components/admin/Users/UserList/EditUserModal.svelte(+59 -0)📝
src/lib/components/chat/Settings/Account.svelte(+5 -0)➕
src/lib/components/chat/Settings/Account/TotpSettings.svelte(+455 -0)📝
src/routes/auth/+page.svelte(+582 -524)📄 Description
TOTP 2FA Authentication Integration
Description
This PR implements a comprehensive TOTP (Time-based One-Time Password) 2FA authentication system for Open WebUI. The implementation adds an optional second authentication factor while maintaining full backward compatibility with existing users.
Related Discussion: https://github.com/open-webui/open-webui/discussions/16338
Changes Summary
Migration file:
e4f7b8c9d2a1_add_totp_fields_to_user_table.pyTesting Completed
✅ Login with/without 2FA enabled
✅ TOTP setup with QR code generation
✅ Backup code usage and regeneration
✅ Password-protected 2FA disable
✅ Token expiration handling
✅ Cross-browser compatibility
✅ Mobile responsiveness
Pull Request Checklist
devbranchqrcodedependency (documented in package.json)feat:prefix for new featureChangelog Entry
Description
Implements TOTP 2FA authentication system providing optional two-factor authentication for enhanced security while maintaining backward compatibility.
Added
POST /auth/totp/setup- Initialize TOTP setupPOST /auth/totp/enable- Enable 2FA with verificationPOST /auth/totp/disable- Disable 2FA (requires password)GET /auth/totp/backup-codes- Retrieve current backup codesPOST /auth/totp/regenerate-backup-codes- Generate new backup codesPOST /auth/signin/totp- Complete authentication with TOTP codeTotpSettings.sveltecomponent for account managementqrcodedependency for QR code generationChanged
Security
Additional Information
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.