mirror of https://github.com/Xhofe/alist
chore: incorrect username retry count
parent
156da2b794
commit
90283ef29c
|
@ -26,7 +26,7 @@ func Login(c *gin.Context) {
|
||||||
ip := c.ClientIP()
|
ip := c.ClientIP()
|
||||||
count, ok := loginCache.Get(ip)
|
count, ok := loginCache.Get(ip)
|
||||||
if ok && count >= defaultTimes {
|
if ok && count >= defaultTimes {
|
||||||
common.ErrorStrResp(c, "Too many unsuccessful sign-in attempts have been made using an incorrect password. Try again later.", 403)
|
common.ErrorStrResp(c, "Too many unsuccessful sign-in attempts have been made using an incorrect username or password. Try again later.", 403)
|
||||||
loginCache.Expire(ip, defaultDuration)
|
loginCache.Expire(ip, defaultDuration)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ func Login(c *gin.Context) {
|
||||||
user, err := db.GetUserByName(req.Username)
|
user, err := db.GetUserByName(req.Username)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
common.ErrorResp(c, err, 400)
|
common.ErrorResp(c, err, 400)
|
||||||
|
loginCache.Set(ip, count+1)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// validate password
|
// validate password
|
||||||
|
|
Loading…
Reference in New Issue