添加用户的冻结功能
This commit is contained in:
@@ -35,6 +35,11 @@ func (b *BaseApi) Login(c *gin.Context) {
|
||||
global.GVA_LOG.Error("登陆失败! 用户名不存在或者密码错误!", zap.Error(err))
|
||||
response.FailWithMessage("用户名不存在或者密码错误", c)
|
||||
} else {
|
||||
if user.Enable != 1 {
|
||||
global.GVA_LOG.Error("登陆失败! 用户被禁止登录!")
|
||||
response.FailWithMessage("用户被禁止登录", c)
|
||||
return
|
||||
}
|
||||
b.TokenNext(c, *user)
|
||||
}
|
||||
} else {
|
||||
@@ -119,7 +124,7 @@ func (b *BaseApi) Register(c *gin.Context) {
|
||||
AuthorityId: v,
|
||||
})
|
||||
}
|
||||
user := &system.SysUser{Username: r.Username, NickName: r.NickName, Password: r.Password, HeaderImg: r.HeaderImg, AuthorityId: r.AuthorityId, Authorities: authorities}
|
||||
user := &system.SysUser{Username: r.Username, NickName: r.NickName, Password: r.Password, HeaderImg: r.HeaderImg, AuthorityId: r.AuthorityId, Authorities: authorities, Enable: r.Enable}
|
||||
userReturn, err := userService.Register(*user)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("注册失败!", zap.Error(err))
|
||||
@@ -296,6 +301,7 @@ func (b *BaseApi) SetUserInfo(c *gin.Context) {
|
||||
Phone: user.Phone,
|
||||
Email: user.Email,
|
||||
SideMode: user.SideMode,
|
||||
Enable: user.Enable,
|
||||
}); err != nil {
|
||||
global.GVA_LOG.Error("设置失败!", zap.Error(err))
|
||||
response.FailWithMessage("设置失败", c)
|
||||
@@ -325,6 +331,7 @@ func (b *BaseApi) SetSelfInfo(c *gin.Context) {
|
||||
Phone: user.Phone,
|
||||
Email: user.Email,
|
||||
SideMode: user.SideMode,
|
||||
Enable: user.Enable,
|
||||
}); err != nil {
|
||||
global.GVA_LOG.Error("设置失败!", zap.Error(err))
|
||||
response.FailWithMessage("设置失败", c)
|
||||
|
Reference in New Issue
Block a user