明树Git Lab

Commit b97ce218 authored by zengfanpei's avatar zengfanpei

update

parent ac4ef43f
const crypto = require('crypto');
const _ = require('lodash');
const mongoose = require('mongoose');
const CryptoJS = require('crypto-js');
const createError = require('http-errors');
......@@ -39,6 +40,13 @@ async function regist(req, res, next) {
// 登录
async function login(req, res, next) {
try {
if(req.body.encryptLogStr){
//避免差异 选用跟前端一样的包
let encryptLogStr = CryptoJS.AES.decrypt(req.body.encryptLogStr, "GFG5w5AP0Ja2rNaa").toString(CryptoJS.enc.Utf8);
let encArr = encryptLogStr.split(",");
req.body.mobile = encArr[0].trim();
req.body.password = encArr[1];
}
const { mobile, password } = req.body;
const user = await userModule.findUserByMobile(mobile);
if (!user) {
......
......@@ -15,6 +15,7 @@
"compression": "1.7.4",
"cors": "2.8.5",
"crypto": "1.0.1",
"crypto-js": "^4.2.0",
"eslint": "9.4.0",
"exceljs": "4.4.0",
"express": "4.19.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