caipin 4 anos atrás
pai
commit
cc4d007f54
2 arquivos alterados com 9 adições e 0 exclusões
  1. 4 0
      services/login_service.go
  2. 5 0
      web/middleware/sessions.go

+ 4 - 0
services/login_service.go

@@ -80,6 +80,10 @@ func (s *loginService) ValidProjectAccount(loginData viewmodels.Login, writer ht
 	if projectAccountInfo.Id == 0 {
 		return nil, errors.New("未找到该账号")
 	}
+	// 2.账号停用
+	if projectAccountInfo.Enable == 0 {
+		return nil, errors.New("该账号已被停用")
+	}
 
 	password := comm.CreatePasswordSign(loginData.Password, loginData.Account)
 

+ 5 - 0
web/middleware/sessions.go

@@ -57,6 +57,11 @@ func SessionsAuth(ctx iris.Context) {
 		ctx.JSON(iris.Map{"code": 1, "msg": "账号不存在"})
 		return
 	}
+	if accountInfo.Enable == 0 {
+		ctx.RemoveCookie("cm")
+		ctx.JSON(iris.Map{"code": 1, "msg": "账号被停用"})
+		return
+	}
 
 	ctx.Values().Set("accountId", identityId)
 	ctx.Values().Set("projectId", attachedIdentityId)