From 17bde54c7c2b51891f8686ff81165ec2b088579d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B6=9B?= Date: Fri, 2 Sep 2022 09:52:02 +0800 Subject: [PATCH] =?UTF-8?q?fix(user):=E6=9B=B4=E6=AD=A3=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=99=BB=E5=BD=95=E9=94=99=E8=AF=AF=E7=9A=84?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=A0=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/user.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/service/user.go b/service/user.go index 538ddd1..83cc44c 100644 --- a/service/user.go +++ b/service/user.go @@ -30,14 +30,14 @@ func (u _UserService) ProcessEnterpriseUserLogin(username, password string) (*mo return nil, exceptions.NewAuthenticationError(404, "用户不存在。") } if user.Type != 0 { - return nil, exceptions.NewAuthenticationError(401, "用户类型不正确。") + return nil, exceptions.NewAuthenticationError(400, "用户类型不正确。") } if !user.Enabled { - return nil, exceptions.NewAuthenticationError(401, "用户已被禁用。") + return nil, exceptions.NewAuthenticationError(403, "用户已被禁用。") } hashedPassword := utils.Sha512Hex(password) if hashedPassword != user.Password { - return nil, exceptions.NewAuthenticationError(401, "用户凭据不正确。") + return nil, exceptions.NewAuthenticationError(402, "用户凭据不正确。") } if user.ResetNeeded { authErr := exceptions.NewAuthenticationError(401, "用户凭据已失效。") @@ -46,7 +46,7 @@ func (u _UserService) ProcessEnterpriseUserLogin(username, password string) (*mo } userDetial, _ := u.retreiveUserDetail(user.Id) if userDetial.ServiceExpiration.Before(time.Now()) { - return nil, exceptions.NewAuthenticationError(401, "用户服务期限已过。") + return nil, exceptions.NewAuthenticationError(406, "用户服务期限已过。") } session := &model.Session{ Token: uuid.New().String(),