API: Refactor authentication failure rate limit #808 #3943

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer
2024-04-04 11:18:05 +02:00
parent 852ee893af
commit 2185618910
15 changed files with 118 additions and 107 deletions

View File

@@ -40,8 +40,8 @@ func CreateUserPasscode(router *gin.RouterGroup) {
return
}
// Check if the account password is correct.
if user.WrongPassword(frm.Password) {
// Check password and abort if invalid.
if user.InvalidPassword(frm.Password) {
Abort(c, http.StatusForbidden, i18n.ErrInvalidPassword)
return
}
@@ -175,8 +175,8 @@ func DeactivateUserPasscode(router *gin.RouterGroup) {
return
}
// Check if the account password is correct.
if user.WrongPassword(frm.Password) {
// Check password and abort if invalid.
if user.InvalidPassword(frm.Password) {
Abort(c, http.StatusForbidden, i18n.ErrInvalidPassword)
return
}