forked from kevadesu/forgejo
Move twofactor to models/login (#17143)
This commit is contained in:
parent
6fb7fb6cfc
commit
91e21d4fca
17 changed files with 131 additions and 121 deletions
|
@ -56,9 +56,9 @@ func DeleteAccountLink(ctx *context.Context) {
|
|||
|
||||
func loadSecurityData(ctx *context.Context) {
|
||||
enrolled := true
|
||||
_, err := models.GetTwoFactorByUID(ctx.User.ID)
|
||||
_, err := login.GetTwoFactorByUID(ctx.User.ID)
|
||||
if err != nil {
|
||||
if models.IsErrTwoFactorNotEnrolled(err) {
|
||||
if login.IsErrTwoFactorNotEnrolled(err) {
|
||||
enrolled = false
|
||||
} else {
|
||||
ctx.ServerError("SettingsTwoFactor", err)
|
||||
|
@ -67,7 +67,7 @@ func loadSecurityData(ctx *context.Context) {
|
|||
}
|
||||
ctx.Data["TwofaEnrolled"] = enrolled
|
||||
if enrolled {
|
||||
ctx.Data["U2FRegistrations"], err = models.GetU2FRegistrationsByUID(ctx.User.ID)
|
||||
ctx.Data["U2FRegistrations"], err = login.GetU2FRegistrationsByUID(ctx.User.ID)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetU2FRegistrationsByUID", err)
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue