Parcourir la source

Merge branch 'master' of http://192.168.1.41:3000/maixinrong/Calculation

TonyKang il y a 5 ans
Parent
commit
d4d6b0b1ad
2 fichiers modifiés avec 13 ajouts et 4 suppressions
  1. 6 2
      app/controller/login_controller.js
  2. 7 2
      app/service/project_account.js

+ 6 - 2
app/controller/login_controller.js

@@ -44,7 +44,11 @@ module.exports = app => {
                 const result = await ctx.service.projectAccount.accountLogin(ctx.request.body, loginType);
 
                 if (!result) {
-                    throw '登录失败';
+                    throw '用户名或密码错误';
+                }
+
+                if (result === 2) {
+                    throw '该账号已被停用,请联系销售人员';
                 }
 
                 // 判断是否已经有对应用户信息,没有则跳转初始化页面
@@ -55,7 +59,7 @@ module.exports = app => {
                 ctx.redirect(query.referer ? query.referer : url);
             } catch (error) {
                 this.log(error);
-                ctx.session.loginError = '用户名或密码错误';
+                ctx.session.loginError = error;
                 ctx.redirect('/login');
             }
         }

+ 7 - 2
app/service/project_account.js

@@ -133,11 +133,16 @@ module.exports = app => {
                     accountData = await this.db.get(this.tableName, {
                         account: data.account.trim(),
                         project_id: projectData.id,
-                        enable: 1,
+                        // enable: 1,
                     });
 
                     if (accountData === null) {
-                        throw '不存在对应用户数据';
+                        throw '用户名或密码错误';
+                    }
+
+                    if (accountData.enable !== 1) {
+                        // throw '该账号已被停用,请联系销售人员';
+                        return 2;
                     }
 
                     projectList = await this.getProjectInfoByAccount(data.account.trim());