guhongwei hace 4 años
padre
commit
f4507d0349
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      app/service/login.js

+ 2 - 2
app/service/login.js

@@ -26,7 +26,7 @@ class LoginService extends CrudService {
     if (!user) {
       // 添加code作为登录的方式
       user = await this.model.findOne({ code: phone, role });
-      if (!user && user.isdel === '0') { throw new BusinessError(ErrorCode.USER_NOT_EXIST); } else is_code = true;
+      if (!user) { throw new BusinessError(ErrorCode.USER_NOT_EXIST); } else is_code = true;
     }
     const pdata = {};
     if (is_code) pdata.code = phone;
@@ -35,7 +35,7 @@ class LoginService extends CrudService {
     // 将用户输入的密码进行加密并与查询到的用户数据密码相比对
     const pas = await this.createJwtPwd(passwd);
     // 如果两个密码不一致抛出异常
-    if (pas !== _user.passwd.secret) {
+    if (pas !== _user.passwd.secret && _user.isdel !== '0') {
       throw new BusinessError(ErrorCode.BAD_PASSWORD);
     }
     if (_user.role === '4' || _user.role === '5') {