From a9f281d4dfd4d09d49451882dff1478887327a16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B6=9B?= Date: Fri, 12 Aug 2022 17:18:11 +0800 Subject: [PATCH] =?UTF-8?q?fix(user):=E5=A2=9E=E5=8A=A0=E5=AF=B9=E4=BA=8E?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=98=AF=E5=90=A6=E8=A2=AB=E7=A6=81=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E5=88=A4=E6=96=AD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/user.go | 6 ++++++ 1 file changed, 6 insertions(+) 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))