mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #3884] [MERGED] feat: mask password in telegram notification on 2FA failure #5548
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#5548
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
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/MHSanaei/3x-ui/pull/3884
Author: @rydve
Created: 3/4/2026
Status: ✅ Merged
Merged: 3/4/2026
Merged by: @MHSanaei
Base:
main← Head:tgbot_2fa_issue_psswd_compromised📝 Commits (1)
fe5e09bfeat: mask password in telegram notification on 2FA failure📊 Changes
15 files changed (+33 additions, -13 deletions)
View changed files
📝
web/controller/index.go(+11 -2)📝
web/service/user.go(+9 -11)📝
web/translation/translate.ar_EG.toml(+1 -0)📝
web/translation/translate.en_US.toml(+1 -0)📝
web/translation/translate.es_ES.toml(+1 -0)📝
web/translation/translate.fa_IR.toml(+1 -0)📝
web/translation/translate.id_ID.toml(+1 -0)📝
web/translation/translate.ja_JP.toml(+1 -0)📝
web/translation/translate.pt_BR.toml(+1 -0)📝
web/translation/translate.ru_RU.toml(+1 -0)📝
web/translation/translate.tr_TR.toml(+1 -0)📝
web/translation/translate.uk_UA.toml(+1 -0)📝
web/translation/translate.vi_VN.toml(+1 -0)📝
web/translation/translate.zh_CN.toml(+1 -0)📝
web/translation/translate.zh_TW.toml(+1 -0)📄 Description
What is the pull request?
This PR improves security by masking the user's password in Telegram login notifications when a two-factor authentication (2FA) failure occurs.
Previously, if a user entered a correct password but an incorrect 2FA code, the system would treat it as a failed login and send the actual (correct) password to the Telegram bot. This could lead to sensitive data being stored in Telegram chat history.
Changes:
Updated UserService.CheckUser to return specific errors for credential vs. 2FA failures.
Modified IndexController.login to detect 2FA errors and replace the password with a masked string *** (2FA Failed) in the Telegram notification.
Added localized strings for 2faFailed across all supported languages in TOML files.
Resolves: #3058
Which part of the application is affected by the change?
Type of Changes
Screenshots
Before (incorrect 2FA, correct login and password):
After:
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.