Authored by 郭成尧

uid-create

@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 10
11 'use strict'; 11 'use strict';
12 12
  13 +const _ = require('lodash');
13 const config = global.yoho.config; 14 const config = global.yoho.config;
14 const utils = require(global.utils); 15 const utils = require(global.utils);
15 const ResetModel = require('../models/reset'); 16 const ResetModel = require('../models/reset');
@@ -48,7 +49,16 @@ const passwordResetPage = (req, res) => { @@ -48,7 +49,16 @@ const passwordResetPage = (req, res) => {
48 */ 49 */
49 const passwordReset = (req, res, next) => { 50 const passwordReset = (req, res, next) => {
50 let passwordWeakObj = req.session.passwordWeak; 51 let passwordWeakObj = req.session.passwordWeak;
51 - let uid = (req.user && req.user.uid) || (passwordWeakObj && passwordWeakObj.uid); 52 + let uid = req.user && req.user.uid;
  53 +
  54 + if (!uid && passwordWeakObj && passwordWeakObj.uid && passwordWeakObj.session_key) {
  55 + uid = {
  56 + toString: () => {
  57 + return _.parseInt(passwordWeakObj.uid);
  58 + },
  59 + sessionKey: passwordWeakObj.session_key
  60 + };
  61 + }
52 62
53 if (!uid || !passwordWeakObj || !passwordWeakObj.token) { 63 if (!uid || !passwordWeakObj || !passwordWeakObj.token) {
54 return res.json({ 64 return res.json({