fix(login):修正监管方登录返回的代码。
This commit is contained in:
parent
7e861ba4e6
commit
c56e1128ff
|
@ -79,14 +79,14 @@ func (u _UserService) ProcessManagementUserLogin(username, password string) (*mo
|
||||||
return nil, exceptions.NewAuthenticationError(404, "用户不存在。")
|
return nil, exceptions.NewAuthenticationError(404, "用户不存在。")
|
||||||
}
|
}
|
||||||
if user.Type != 1 && user.Type != 2 {
|
if user.Type != 1 && user.Type != 2 {
|
||||||
return nil, exceptions.NewAuthenticationError(401, "用户类型不正确。")
|
return nil, exceptions.NewAuthenticationError(400, "用户类型不正确。")
|
||||||
}
|
}
|
||||||
if !user.Enabled {
|
if !user.Enabled {
|
||||||
return nil, exceptions.NewAuthenticationError(401, "用户已被禁用。")
|
return nil, exceptions.NewAuthenticationError(403, "用户已被禁用。")
|
||||||
}
|
}
|
||||||
hashedPassword := utils.Sha512Hex(password)
|
hashedPassword := utils.Sha512Hex(password)
|
||||||
if hashedPassword != user.Password {
|
if hashedPassword != user.Password {
|
||||||
return nil, exceptions.NewAuthenticationError(401, "用户凭据不正确。")
|
return nil, exceptions.NewAuthenticationError(402, "用户凭据不正确。")
|
||||||
}
|
}
|
||||||
if user.ResetNeeded {
|
if user.ResetNeeded {
|
||||||
authErr := exceptions.NewAuthenticationError(401, "用户凭据已失效。")
|
authErr := exceptions.NewAuthenticationError(401, "用户凭据已失效。")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user