Commit 5e09b037 by Sxy

fix: 回改加密

parent d55f6850
...@@ -165,15 +165,15 @@ class UserService extends ServiceBase { ...@@ -165,15 +165,15 @@ class UserService extends ServiceBase {
if (u.password != inpassword) { if (u.password != inpassword) {
return null; return null;
} }
// let last = new Date(u.last_change_date).getTime();//注意月份 let last = new Date(u.last_change_date).getTime();//注意月份
// let differ = Date.now() - last; let differ = Date.now() - last;
// let days = Math.round(differ / (24 * 60 * 60 * 1000)); let days = Math.round(differ / (24 * 60 * 60 * 1000));
// if (u.last_change_date && days >= settings.changepwdcycle) {//禁用用户 if (u.last_change_date && days >= settings.changepwdcycle) {//禁用用户
// await this.dao.updateByWhere({ isEnabled: false }, { userName: p.userName }) await this.dao.updateByWhere({ isEnabled: false }, { userName: p.userName })
// return null return null
// } else if ((settings.changepwdcycle - 7) <= days) { } else if ((settings.changepwdcycle - 7) <= days) {
// rtn.hint = "请尽快修改密码,否则会禁用您的账户" rtn.hint = "请尽快修改密码,否则会禁用您的账户"
// } }
return this.db.transaction(async function (t) { return this.db.transaction(async function (t) {
//从缓存中取得 //从缓存中取得
// let userfind = await self.dao.model.findOne({ // let userfind = await self.dao.model.findOne({
......
...@@ -12,7 +12,6 @@ class ServiceBase { ...@@ -12,7 +12,6 @@ class ServiceBase {
this.dao = system.getObject("db." + gname + "." + daoName); this.dao = system.getObject("db." + gname + "." + daoName);
this.restS = system.getObject("util.restClient"); this.restS = system.getObject("util.restClient");
this.crypto = require('crypto'); this.crypto = require('crypto');
this.md5 = require("MD5");
} }
/** /**
* *
...@@ -26,10 +25,8 @@ class ServiceBase { ...@@ -26,10 +25,8 @@ class ServiceBase {
if (isComplexVerification) { if (isComplexVerification) {
this.complexVerification(str) this.complexVerification(str)
} }
// let pwd = this.crypto.createHash("sha256").update(str + "_" + settings.salt, "utf8").digest("base64"); let pwd = this.crypto.createHash("sha256").update(str + "_" + settings.salt, "utf8").digest("base64");
// return pwd.toLowerCase(); return pwd.toLowerCase();
var md5 = this.md5(str + "_" + settings.salt);
return md5.toString().toLowerCase();
} }
complexVerification(str) { complexVerification(str) {
......
...@@ -20,7 +20,7 @@ var settings = { ...@@ -20,7 +20,7 @@ var settings = {
encrypt_secret: ENVINPUT.ENCRYPT_SECRET, encrypt_secret: ENVINPUT.ENCRYPT_SECRET,
salt: "%iatpD1gcxz7iF#B", salt: "%iatpD1gcxz7iF#B",
defaultpwd: "Temp123456", defaultpwd: "Temp123456",
changepwdcycle: 360000,//密码更换周期 7天前登录提示更改密码 到期后直接禁用账户 changepwdcycle: 60,//密码更换周期 7天前登录提示更改密码 到期后直接禁用账户
basepath: path.normalize(path.join(__dirname, '../..')), basepath: path.normalize(path.join(__dirname, '../..')),
port: process.env.NODE_PORT || 80, port: process.env.NODE_PORT || 80,
logindex: "center_manage", logindex: "center_manage",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment