File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -26,8 +26,9 @@ import (
2626
2727var loginCache = cache .NewMemCache [int ]()
2828var (
29- defaultDuration = time .Minute * 5
30- defaultTimes = 5
29+ defaultDuration = time .Minute * 5
30+ defaultTimes = 5
31+ invalidLoginCredentialsMsg = "username or password is incorrect"
3132)
3233
3334type LoginReq struct {
@@ -69,13 +70,13 @@ func loginHash(c *gin.Context, req *LoginReq) {
6970 // check username
7071 user , err := op .GetUserByName (req .Username )
7172 if err != nil {
72- common .ErrorResp (c , err , 400 )
73+ common .ErrorStrResp (c , invalidLoginCredentialsMsg , 400 )
7374 loginCache .Set (ip , count + 1 )
7475 return
7576 }
7677 // validate password hash
7778 if err := user .ValidatePwdStaticHash (req .Password ); err != nil {
78- common .ErrorResp (c , err , 400 )
79+ common .ErrorStrResp (c , invalidLoginCredentialsMsg , 400 )
7980 loginCache .Set (ip , count + 1 )
8081 return
8182 }
You can’t perform that action at this time.
0 commit comments