Browse Source

更新

master
huangjiajun 1 month ago
parent
commit
5313257dad
2 changed files with 9 additions and 1 deletions
  1. +5
    -1
      app/hdl/hdl_login.go
  2. +4
    -0
      app/mw/mw_auth.go

+ 5
- 1
app/hdl/hdl_login.go View File

@@ -57,7 +57,11 @@ func Login(c *gin.Context) {
return
}
if utils.Md5(req.PassWord) != admin.Password {
e.OutErr(c, e.ERR_INVALID_ARGS, "密码错误")
e.OutErr(c, 400, e.NewErr(400, "密码错误"))
return
}
if admin.State == 2 {
e.OutErr(c, 400, e.NewErr(400, "账号被禁用"))
return
}
ip := utils.GetIP(c.Request)


+ 4
- 0
app/mw/mw_auth.go View File

@@ -20,6 +20,10 @@ func Auth(c *gin.Context) {
return
}
}
if admin != nil && admin.State == 2 {
e.OutErr(c, e.ERR_TOKEN_AUTH, e.NewErr(401003, "账号已被禁用"))
return
}
// 将当前请求的username信息保存到请求的上下文c上
c.Set("admin", admin)
if len(newToken) > 0 {


Loading…
Cancel
Save