fix: purge authentication data on hard user deletion (#6168)

* fix: purge authentication data on hard user deletion

* fix: fail closed when 2FA status lookup fails

* fix: reject stale Telegram login callbacks

* fix(twofa): prevent concurrent backup code and lockout bypasses

* fix(auth): harden user deletion and Telegram verification
This commit is contained in:
Seefs
2026-07-14 14:25:54 +08:00
committed by GitHub
parent 7c28993f6b
commit b6b97a66e3
8 changed files with 371 additions and 51 deletions
+7 -1
View File
@@ -73,7 +73,13 @@ func Login(c *gin.Context) {
}
// 检查是否启用2FA
if model.IsTwoFAEnabled(user.Id) {
twoFAEnabled, err := model.IsTwoFAEnabled(user.Id)
if err != nil {
common.SysLog(fmt.Sprintf("Login failed to load 2FA status for user %d: %v", user.Id, err))
common.ApiErrorI18n(c, i18n.MsgDatabaseError)
return
}
if twoFAEnabled {
// 设置pending session,等待2FA验证
session := sessions.Default(c)
session.Set("pending_username", user.Username)