|
|
@ -221,7 +221,7 @@ func TwoFactorPost(ctx *context.Context, form auth.TwoFactorAuthForm) { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if ok { |
|
|
|
if ok && twofa.LastUsedPasscode != form.Passcode { |
|
|
|
remember := ctx.Session.Get("twofaRemember").(bool) |
|
|
|
u, err := models.GetUserByID(id) |
|
|
|
if err != nil { |
|
|
@ -243,6 +243,12 @@ func TwoFactorPost(ctx *context.Context, form auth.TwoFactorAuthForm) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
twofa.LastUsedPasscode = form.Passcode |
|
|
|
if err = models.UpdateTwoFactor(twofa); err != nil { |
|
|
|
ctx.ServerError("UserSignIn", err) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
handleSignIn(ctx, u, remember) |
|
|
|
return |
|
|
|
} |
|
|
|