Commit f87f6d5f by 蒋勇

d

parent 91030602
...@@ -152,7 +152,8 @@ class UserService extends ServiceBase { ...@@ -152,7 +152,8 @@ class UserService extends ServiceBase {
} else { } else {
console.log(JSON.stringify(consumer.data)) console.log(JSON.stringify(consumer.data))
let password = consumer.data.tags[1].split("_")[1]; let password = consumer.data.tags[1].split("_")[1];
let inpassword = this.getEncryptStr(p.password); let passwd = system.desEncript(p.password)
let inpassword = this.getEncryptStr(passwd);
if (password != inpassword) { if (password != inpassword) {
return null; return null;
} }
......
...@@ -4,6 +4,7 @@ var settings = require("../config/settings"); ...@@ -4,6 +4,7 @@ var settings = require("../config/settings");
const request = require('request'); const request = require('request');
const jwk2pem = require('pem-jwk').jwk2pem const jwk2pem = require('pem-jwk').jwk2pem
const jwt = require('jsonwebtoken') const jwt = require('jsonwebtoken')
const CryptoJS = require("crypto-js")
class System { class System {
static declare (ns) { static declare (ns) {
var ar = ns.split('.'); var ar = ns.split('.');
...@@ -308,7 +309,18 @@ class System { ...@@ -308,7 +309,18 @@ class System {
return P return P
} }
static desEncript (desstr) {
let deskey = '647a68c9-da01-40d3-9763-1ffa0f64cf3f'
var keyHex = CryptoJS.enc.Utf8.parse(deskey);
// direct decrypt ciphertext
var decrypted = CryptoJS.DES.decrypt({
ciphertext: CryptoJS.enc.Base64.parse(desstr)
}, keyHex, {
mode: CryptoJS.mode.ECB,
padding: CryptoJS.pad.Pkcs7
});
return decrypted.toString(CryptoJS.enc.Utf8);
}
} }
Date.prototype.Format = function (fmt) { //author: meizz Date.prototype.Format = function (fmt) { //author: meizz
var o = { var o = {
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
"continuation-local-storage": "^3.2.1", "continuation-local-storage": "^3.2.1",
"cookie-parser": "^1.4.3", "cookie-parser": "^1.4.3",
"crypto": "^1.0.1", "crypto": "^1.0.1",
"crypto-js": "^3.1.9-1", "crypto-js": "^3.3.0",
"easyimage": "^3.1.0", "easyimage": "^3.1.0",
"ejs": "^2.5.8", "ejs": "^2.5.8",
"engine.io-parser": "^2.1.2", "engine.io-parser": "^2.1.2",
......
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