Reset failed totp attempts when logging in successfully

This commit is contained in:
kolaente 2021-07-30 14:46:10 +02:00
parent 24f7d9b4f7
commit 220f43331f
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -19,6 +19,8 @@ package v1
import (
"net/http"
"code.vikunja.io/api/pkg/modules/keyvalue"
"code.vikunja.io/api/pkg/db"
"code.vikunja.io/api/pkg/models"
"code.vikunja.io/api/pkg/modules/auth"
@ -87,6 +89,10 @@ func Login(c echo.Context) error {
}
}
if err := keyvalue.Del(user.GetFailedTOTPAttemptsKey()); err != nil {
return err
}
if err := s.Commit(); err != nil {
_ = s.Rollback()
return handler.HandleHTTPError(err, c)