[PR #2968] [MERGED] chore: implement 2fa auth #5315

Closed
opened 2026-10-31 20:46:07 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/2968
Author: @sh1shd
Created: 5/3/2025
Status: ✅ Merged
Merged: 5/8/2025
Merged by: @MHSanaei

Base: main ← Head: feat/2fa


📝 Commits (9)

  • 2c53007 chore: implement 2fa auth
  • 2eb10ac Merge branch 'main' into feat/2fa
  • 4cea5c3 chore: format code
  • ca0cf0b Merge branch 'main' into feat/2fa
  • 9e94aba chore: replace two factor token input with qr-code
  • 37c6f50 chore: requesting confirmation of setting/removing two-factor authentication
  • 73d5992 chore: revert changes in ClipboardManager
  • 83f2240 chore: removing twoFactor prop in settings page
  • fedcd16 chore: remove twoFactorQr object in mounted function

📊 Changes

31 files changed (+452 additions, -302 deletions)

View changed files

📝 database/db.go (+2 -4)
📝 database/model/model.go (+3 -4)
📝 go.mod (+2 -1)
📝 go.sum (+2 -0)
📝 main.go (+0 -35)
📝 web/assets/js/model/setting.js (+2 -1)
📝 web/assets/js/util/index.js (+27 -0)
➕ web/assets/otpauth/otpauth.umd.min.js (+19 -0)
📝 web/controller/index.go (+8 -9)
📝 web/controller/setting.go (+0 -29)
📝 web/entity/entity.go (+2 -1)
📝 web/html/login.html (+10 -10)
➕ web/html/modals/two_factor_modal.html (+118 -0)
📝 web/html/settings.html (+31 -33)
📝 web/html/settings/panel/security.html (+4 -20)
📝 web/service/setting.go (+11 -11)
📝 web/service/user.go (+28 -50)
📝 web/translation/translate.ar_EG.toml (+14 -7)
📝 web/translation/translate.en_US.toml (+14 -7)
📝 web/translation/translate.es_ES.toml (+14 -7)

...and 11 more files

📄 Description

What is the pull request?

This pull request replaces the secret token with 2fa authentication.

Two-factor authentication differs from secret token in that a new code is generated every 30 seconds, which cannot be selected using the brute force method. 2FA token can be added to any authentication application (Bitwarden, Google Authenticator, and so on.)

Which part of the application is affected by the change?

  • Frontend
  • Backend

Type of Changes

  • Bug fix
  • New feature
  • Refactoring
  • Other

Screenshots

image


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/2968 **Author:** [@sh1shd](https://github.com/sh1shd) **Created:** 5/3/2025 **Status:** ✅ Merged **Merged:** 5/8/2025 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `feat/2fa` --- ### 📝 Commits (9) - [`2c53007`](https://github.com/MHSanaei/3x-ui/commit/2c53007580ddd646c2ab34ade8b4345b5d9122c9) chore: implement 2fa auth - [`2eb10ac`](https://github.com/MHSanaei/3x-ui/commit/2eb10ac9e25bb3a8890b2e8902968f66c9e639fe) Merge branch 'main' into feat/2fa - [`4cea5c3`](https://github.com/MHSanaei/3x-ui/commit/4cea5c394cff1cfa586192820c229249eb1992d6) chore: format code - [`ca0cf0b`](https://github.com/MHSanaei/3x-ui/commit/ca0cf0b8ea3e2722c28623c2869adf89c621d69d) Merge branch 'main' into feat/2fa - [`9e94aba`](https://github.com/MHSanaei/3x-ui/commit/9e94aba64915ebccf37e7aecfdbb76e73e36c672) chore: replace two factor token input with qr-code - [`37c6f50`](https://github.com/MHSanaei/3x-ui/commit/37c6f50b2e4a65bd5b564746c5482933e45a329e) chore: requesting confirmation of setting/removing two-factor authentication - [`73d5992`](https://github.com/MHSanaei/3x-ui/commit/73d59920dbba06f0c341fdde0948230e2d1679a1) chore: revert changes in `ClipboardManager` - [`83f2240`](https://github.com/MHSanaei/3x-ui/commit/83f22403c8a4e5f8b97a59f866598c71f022f0e8) chore: removing twoFactor prop in settings page - [`fedcd16`](https://github.com/MHSanaei/3x-ui/commit/fedcd16780257fbe5837a73b7eed8b4f4db85c7c) chore: remove `twoFactorQr` object in `mounted` function ### 📊 Changes **31 files changed** (+452 additions, -302 deletions) <details> <summary>View changed files</summary> 📝 `database/db.go` (+2 -4) 📝 `database/model/model.go` (+3 -4) 📝 `go.mod` (+2 -1) 📝 `go.sum` (+2 -0) 📝 `main.go` (+0 -35) 📝 `web/assets/js/model/setting.js` (+2 -1) 📝 `web/assets/js/util/index.js` (+27 -0) ➕ `web/assets/otpauth/otpauth.umd.min.js` (+19 -0) 📝 `web/controller/index.go` (+8 -9) 📝 `web/controller/setting.go` (+0 -29) 📝 `web/entity/entity.go` (+2 -1) 📝 `web/html/login.html` (+10 -10) ➕ `web/html/modals/two_factor_modal.html` (+118 -0) 📝 `web/html/settings.html` (+31 -33) 📝 `web/html/settings/panel/security.html` (+4 -20) 📝 `web/service/setting.go` (+11 -11) 📝 `web/service/user.go` (+28 -50) 📝 `web/translation/translate.ar_EG.toml` (+14 -7) 📝 `web/translation/translate.en_US.toml` (+14 -7) 📝 `web/translation/translate.es_ES.toml` (+14 -7) _...and 11 more files_ </details> ### 📄 Description ## What is the pull request? This pull request replaces the `secret token` with `2fa authentication`. Two-factor authentication differs from secret token in that a new code is generated every 30 seconds, which cannot be selected using the brute force method. 2FA token can be added to any authentication application (Bitwarden, Google Authenticator, and so on.) ## Which part of the application is affected by the change? - [x] Frontend - [X] Backend ## Type of Changes - [ ] Bug fix - [X] New feature - [X] Refactoring - [ ] Other ## Screenshots ![image](https://github.com/user-attachments/assets/f278367f-1a4f-49f4-86f4-27e32cc9173c) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 20:46:07 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#5315
No description provided.