fix(user):增加对于用户是否被禁用的判断。
This commit is contained in:
parent
fd9de54262
commit
a9f281d4df
|
@ -31,6 +31,9 @@ func (_UserService) ProcessEnterpriseUserLogin(username, password string) (*mode
|
|||
if user.Type != 0 {
|
||||
return nil, exceptions.NewAuthenticationError(401, "用户类型不正确。")
|
||||
}
|
||||
if !user.Enabled {
|
||||
return nil, exceptions.NewAuthenticationError(401, "用户已被禁用。")
|
||||
}
|
||||
hash := sha512.New512_256()
|
||||
hash.Write([]byte(password))
|
||||
hashedPassword := fmt.Sprintf("%x", hash.Sum(nil))
|
||||
|
@ -69,6 +72,9 @@ func (_UserService) ProcessManagementUserLogin(username, password string) (*mode
|
|||
if user.Type != 1 && user.Type != 2 {
|
||||
return nil, exceptions.NewAuthenticationError(401, "用户类型不正确。")
|
||||
}
|
||||
if !user.Enabled {
|
||||
return nil, exceptions.NewAuthenticationError(401, "用户已被禁用。")
|
||||
}
|
||||
hash := sha512.New512_256()
|
||||
hash.Write([]byte(password))
|
||||
hashedPassword := fmt.Sprintf("%x", hash.Sum(nil))
|
||||
|
|
Loading…
Reference in New Issue
Block a user