Showing
1 changed file
with
11 additions
and
11 deletions
@@ -7,18 +7,18 @@ const crypto = global.yoho.crypto; | @@ -7,18 +7,18 @@ const crypto = global.yoho.crypto; | ||
7 | module.exports = () => { | 7 | module.exports = () => { |
8 | return (req, res, next) => { | 8 | return (req, res, next) => { |
9 | // 从 SESSION 中获取到当前登录用户的 UID | 9 | // 从 SESSION 中获取到当前登录用户的 UID |
10 | - // if (req.session && _.isNumber(req.session.LOGIN_UID)) { | ||
11 | - // // 不要使用 === 判断uid的值,如果需要判断使用 == | ||
12 | - // req.user.uid = { | ||
13 | - // toString: () => { | ||
14 | - // return req.session.LOGIN_UID; | ||
15 | - // }, | ||
16 | - // sessionKey: req.session.SESSION_KEY | ||
17 | - // }; | ||
18 | - // let userData = _.get(req.session, 'USER', {}); | 10 | + if (req.session && _.isNumber(req.session.LOGIN_UID)) { |
11 | + // 不要使用 === 判断uid的值,如果需要判断使用 == | ||
12 | + req.user.uid = { | ||
13 | + toString: () => { | ||
14 | + return req.session.LOGIN_UID; | ||
15 | + }, | ||
16 | + sessionKey: req.session.SESSION_KEY | ||
17 | + }; | ||
18 | + let userData = _.get(req.session, 'USER', {}); | ||
19 | 19 | ||
20 | - // _.merge(req.user, userData); | ||
21 | - // } | 20 | + _.merge(req.user, userData); |
21 | + } | ||
22 | 22 | ||
23 | // session 没有读取到的时候,从 cookie 读取 UID | 23 | // session 没有读取到的时候,从 cookie 读取 UID |
24 | if (!req.user.uid && req.cookies._UID) { | 24 | if (!req.user.uid && req.cookies._UID) { |
-
Please register or login to post a comment