Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
5
51business
Project
Project
Details
Activity
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
方斌
51business
Commits
2f86ea37
Commit
2f86ea37
authored
Sep 24, 2019
by
Hsinli
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of t-git.51gjj.com:fangbin/51business
parents
5683f933
e440142c
Pipeline
#14066
passed with stage
in 28 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
user.js
app/controller/course/user.js
+1
-1
mini_auth.js
app/middleware/mini_auth.js
+4
-4
No files found.
app/controller/course/user.js
View file @
2f86ea37
...
@@ -27,7 +27,7 @@ class UserController extends Controller {
...
@@ -27,7 +27,7 @@ class UserController extends Controller {
//存储缓存标识
//存储缓存标识
const
user_uuid
=
user
.
uuid
;
const
user_uuid
=
user
.
uuid
;
const
key
=
'course_user_session_'
+
user_uuid
;
const
key
=
'course_user_session_'
+
user_uuid
;
await
app
.
memcache
.
set
(
key
,
{
user_uuid
,
openid
},
86400
);
await
app
.
memcache
.
set
(
key
,
{
user_uuid
,
openid
},
86400
*
180
);
const
auth_token
=
ctx
.
helper
.
md5
(
openid
+
user_uuid
+
'jbwl'
);
const
auth_token
=
ctx
.
helper
.
md5
(
openid
+
user_uuid
+
'jbwl'
);
ctx
.
set
(
'uuid'
,
key
);
ctx
.
set
(
'uuid'
,
key
);
ctx
.
set
(
'auth_token'
,
auth_token
);
ctx
.
set
(
'auth_token'
,
auth_token
);
...
...
app/middleware/mini_auth.js
View file @
2f86ea37
...
@@ -8,15 +8,15 @@ module.exports = (options, app) => {
...
@@ -8,15 +8,15 @@ module.exports = (options, app) => {
const
key
=
'course_user_session_'
+
uuid
;
const
key
=
'course_user_session_'
+
uuid
;
const
auth_info
=
await
ctx
.
app
.
memcache
.
get
(
key
);
const
auth_info
=
await
ctx
.
app
.
memcache
.
get
(
key
);
if
(
!
auth_info
)
{
if
(
!
auth_info
)
{
await
next
();
//
await next();
return
;
//
return;
//
ctx.failed('login auth error');
ctx
.
failed
(
'login auth error'
);
}
}
const
openid
=
auth_info
.
openid
;
const
openid
=
auth_info
.
openid
;
const
user_uuid
=
auth_info
.
user_uuid
;
const
user_uuid
=
auth_info
.
user_uuid
;
const
auth_token
=
ctx
.
headers
.
auth_token
;
const
auth_token
=
ctx
.
headers
.
auth_token
;
if
(
ctx
.
helper
.
md5
(
openid
+
uuid
+
'jbwl'
)
!=
auth_token
)
{
if
(
ctx
.
helper
.
md5
(
openid
+
uuid
+
'jbwl'
)
!=
auth_token
)
{
//
ctx.failed('login auth error');
ctx
.
failed
(
'login auth error'
);
}
}
ctx
.
setUserUuid
(
user_uuid
);
ctx
.
setUserUuid
(
user_uuid
);
...
...
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