chore: init users

This commit is contained in:
Noah Hsu
2022-06-25 22:05:02 +08:00
parent b474eefd87
commit 54ca68e4b3
7 changed files with 88 additions and 12 deletions

View File

@ -36,12 +36,12 @@ func Login(c *gin.Context) {
}
user, err := db.GetUserByName(req.Username)
if err != nil {
common.ErrorResp(c, err, 400)
common.ErrorResp(c, err, 400, true)
return
}
// validate password
if err := user.ValidatePassword(req.Password); err != nil {
common.ErrorResp(c, err, 400)
common.ErrorResp(c, err, 400, true)
loginCache.Set(ip, count+1)
return
}