明树Git Lab
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
L
letian_backend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zengfanpei
letian_backend
Commits
b97ce218
Commit
b97ce218
authored
Oct 09, 2024
by
zengfanpei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
ac4ef43f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
userController.js
controller/userController.js
+8
-0
package.json
package.json
+1
-0
No files found.
controller/userController.js
View file @
b97ce218
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
)
{
...
...
package.json
View file @
b97ce218
...
...
@@ -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
"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment