mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-14 22:16:14 +01:00
Fix disable 2fa bug (#32320)
(cherry picked from commit 2abdbe88b5d16dcb345d27b73f1d9738f2d826dd)
This commit is contained in:
parent
261c0a95b4
commit
480d565944
1 changed files with 6 additions and 3 deletions
|
@ -34,8 +34,9 @@ func RegenerateScratchTwoFactor(ctx *context.Context) {
|
||||||
if auth.IsErrTwoFactorNotEnrolled(err) {
|
if auth.IsErrTwoFactorNotEnrolled(err) {
|
||||||
ctx.Flash.Error(ctx.Tr("settings.twofa_not_enrolled"))
|
ctx.Flash.Error(ctx.Tr("settings.twofa_not_enrolled"))
|
||||||
ctx.Redirect(setting.AppSubURL + "/user/settings/security")
|
ctx.Redirect(setting.AppSubURL + "/user/settings/security")
|
||||||
|
} else {
|
||||||
|
ctx.ServerError("SettingsTwoFactor: Failed to GetTwoFactorByUID", err)
|
||||||
}
|
}
|
||||||
ctx.ServerError("SettingsTwoFactor: Failed to GetTwoFactorByUID", err)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,8 +65,9 @@ func DisableTwoFactor(ctx *context.Context) {
|
||||||
if auth.IsErrTwoFactorNotEnrolled(err) {
|
if auth.IsErrTwoFactorNotEnrolled(err) {
|
||||||
ctx.Flash.Error(ctx.Tr("settings.twofa_not_enrolled"))
|
ctx.Flash.Error(ctx.Tr("settings.twofa_not_enrolled"))
|
||||||
ctx.Redirect(setting.AppSubURL + "/user/settings/security")
|
ctx.Redirect(setting.AppSubURL + "/user/settings/security")
|
||||||
|
} else {
|
||||||
|
ctx.ServerError("SettingsTwoFactor: Failed to GetTwoFactorByUID", err)
|
||||||
}
|
}
|
||||||
ctx.ServerError("SettingsTwoFactor: Failed to GetTwoFactorByUID", err)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,8 +76,9 @@ func DisableTwoFactor(ctx *context.Context) {
|
||||||
// There is a potential DB race here - we must have been disabled by another request in the intervening period
|
// There is a potential DB race here - we must have been disabled by another request in the intervening period
|
||||||
ctx.Flash.Success(ctx.Tr("settings.twofa_disabled"))
|
ctx.Flash.Success(ctx.Tr("settings.twofa_disabled"))
|
||||||
ctx.Redirect(setting.AppSubURL + "/user/settings/security")
|
ctx.Redirect(setting.AppSubURL + "/user/settings/security")
|
||||||
|
} else {
|
||||||
|
ctx.ServerError("SettingsTwoFactor: Failed to DeleteTwoFactorByID", err)
|
||||||
}
|
}
|
||||||
ctx.ServerError("SettingsTwoFactor: Failed to DeleteTwoFactorByID", err)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue