Reset failed totp attempts when logging in successfully
continuous-integration/drone/push Build is failing Details

This commit is contained in:
kolaente 2021-07-30 14:46:10 +02:00
parent 24f7d9b4f7
commit 220f43331f
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 6 additions and 0 deletions

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)