...
|
...
|
@@ -38,12 +38,12 @@ module.exports = { |
|
|
apis: {
|
|
|
Ilogin: {
|
|
|
title:'登录接口',
|
|
|
url: Iaccount.login,
|
|
|
form: '["{{user}}","{{password}}",{{website}}]',
|
|
|
url: Iaccount.loginEx,
|
|
|
// form: '["{{account}}","{{password}}",{{platform}}]', 北京erp java登录接口,只接受application/json
|
|
|
params: {
|
|
|
user: { type: String },
|
|
|
account: { type: String },
|
|
|
password: { type: String },
|
|
|
website: {type:Number,default: Iaccount.WEBSITE}
|
|
|
platform: {type:Number,default: 2}
|
|
|
}
|
|
|
},
|
|
|
getResourceByPid: {
|
...
|
...
|
@@ -73,28 +73,25 @@ module.exports = { |
|
|
}
|
|
|
},
|
|
|
login: function (req, callback, common) {
|
|
|
|
|
|
console.log("enter login method ........................................");
|
|
|
|
|
|
var userInfo = {},result = { code: 400, message: "登录失败" },isSuccess=false;
|
|
|
|
|
|
|
|
|
var user = req.body.user||req.query.user;
|
|
|
var password = req.body.password||req.query.password;
|
|
|
var errcallback = function (err) {
|
|
|
|
|
|
console.log("enter login method ........................................&&&&&&&&&&&&&&&&&&&&&&&" + err);
|
|
|
|
|
|
result.code = err.errorCode;
|
|
|
return callback(null, result);
|
|
|
}
|
|
|
|
|
|
console.log("enter login method ........................................************");
|
|
|
console.log("begin enter common Ilogin --------------------------------------------------------------------------------------");
|
|
|
|
|
|
common.Ilogin(user, password).allRight().sessionAsync(user, password).done(function (IloginRes,allRes,sesRes) {
|
|
|
var userData = IloginRes.data, cookie = sesRes.caseless.dict["set-cookie"];
|
|
|
|
|
|
console.log("enter userData is ........................................" + userData);
|
|
|
console.log("enter common Ilogin, code: " + IloginRes.code + ", pwdComplexRate: " + IloginRes.data.pwdComplexRate);
|
|
|
|
|
|
result.code = IloginRes.code;
|
|
|
result.pwdComplexRate = IloginRes.data.pwdComplexRate;
|
|
|
result.passwd_time = IloginRes.data.pwdExpirationDays;
|
|
|
|
|
|
userInfo = { auth: userData, uid: userData.pid, name: userData.truename, role: userData.roleName, right: {},shopList:[],brands:[]};
|
|
|
if(userData.data_authority&&userData.data_authority.brand&&userData.data_authority.brand.list){
|
...
|
...
|
@@ -106,7 +103,21 @@ module.exports = { |
|
|
}
|
|
|
});
|
|
|
common.getResourceByPid(userData.pid, userData.role_id).done(function (getRRes) {
|
|
|
if (result.pwdComplexRate != undefined && !result.pwdComplexRate) { // 如果是弱密码,则需要强制修改密码,这里就不要展示任何菜单
|
|
|
userInfo.menu = [];
|
|
|
} else {
|
|
|
userInfo.menu = Utils.createrMenus(getRRes.data);
|
|
|
}
|
|
|
|
|
|
// 如果是要过期,则需要提示用户密码要过期
|
|
|
console.log("enter getResourceByPid, passwd_time: " + result.passwd_time);
|
|
|
if (result.passwd_time != undefined && result.passwd_time > 0) {
|
|
|
userInfo.passwordMsg = '密码' + result.passwd_time + '天后过期,请尽快修改';
|
|
|
} else if (result.passwd_time != undefined && result.passwd_time <= 0) {
|
|
|
userInfo.passwordMsg = '密码已过期,请尽快修改';
|
|
|
}
|
|
|
console.log("enter getResourceByPid, passwordMsg: " + userInfo.passwordMsg);
|
|
|
|
|
|
req.session.user = userInfo;
|
|
|
if (cookie && cookie.length > 0) {
|
|
|
req.session.gray = cookie[0];
|
...
|
...
|
|