diff --git a/service/user.go b/service/user.go index 5a0d438..7be26e8 100644 --- a/service/user.go +++ b/service/user.go @@ -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))