aboutsummaryrefslogtreecommitdiffstats
path: root/routers/user/auth.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/user/auth.go')
-rw-r--r--routers/user/auth.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/routers/user/auth.go b/routers/user/auth.go
index d44939f50d..4249f9e5f9 100644
--- a/routers/user/auth.go
+++ b/routers/user/auth.go
@@ -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
}