...
|
...
|
@@ -3,7 +3,6 @@ const co = Promise.coroutine; |
|
|
const helpers = global.yoho.helpers;
|
|
|
const sign = global.yoho.sign;
|
|
|
const BackServiceModel = require('../models/back-service');
|
|
|
const captchaService = require('../models/captcha-service');
|
|
|
const SIGN_IN = helpers.urlFormat('/signin.html');
|
|
|
|
|
|
class BackNew {
|
...
|
...
|
@@ -100,24 +99,6 @@ class BackNew { |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 通过邮箱找回密码页面
|
|
|
*/
|
|
|
indexEmailPage(req, res) {
|
|
|
res.render('back/email', Object.assign(
|
|
|
{
|
|
|
module: 'passport',
|
|
|
page: 'back-email',
|
|
|
title: '找回密码-通过邮箱'
|
|
|
}, {
|
|
|
// backUrl: SIGN_IN,
|
|
|
headerText: '找回密码',
|
|
|
isPassportPage: true,
|
|
|
backEmail: true
|
|
|
}
|
|
|
));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 发送验证码到邮箱
|
|
|
*/
|
|
|
sendCodeToEmailAPI(req, res) {
|
...
|
...
|
@@ -221,60 +202,6 @@ class BackNew { |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 找回密码页面-通过手机号
|
|
|
*/
|
|
|
indexMobilePage(req, res, next) {
|
|
|
_.set(req.session, 'backupCaptch.verifyResult', false);
|
|
|
|
|
|
if (req.session.captchaValidCount == null) { // eslint-disable-line
|
|
|
req.session.captchaValidCount = 5;
|
|
|
}
|
|
|
|
|
|
req.ctx(BackServiceModel).getAreaDataAsync()
|
|
|
.then(result => {
|
|
|
res.render('back/mobile', Object.assign({
|
|
|
width750: true,
|
|
|
module: 'passport',
|
|
|
page: 'back-mobile',
|
|
|
title: '找回密码-通过手机号'
|
|
|
}, {
|
|
|
// backUrl: SIGN_IN,
|
|
|
headerText: '找回密码',
|
|
|
isPassportPage: true,
|
|
|
backMobile: true,
|
|
|
countrys: result.data,
|
|
|
areaCode: '+86',
|
|
|
verifySrc: helpers.urlFormat('/passport/back/generatecodeimg.png', {t: Date.now()})
|
|
|
}));
|
|
|
})
|
|
|
.catch(next);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 生成验证码
|
|
|
* @param req
|
|
|
* @param res
|
|
|
*/
|
|
|
generateCodeImg(req, res) {
|
|
|
let verifyCodeImg = captchaService.generateCaptcha(109, 50, 4);
|
|
|
|
|
|
if (verifyCodeImg) {
|
|
|
|
|
|
if (req.session.backupCaptch) {
|
|
|
req.session.backupCaptch.code = verifyCodeImg.text;
|
|
|
req.session.backupCaptch.verifyResult = false;
|
|
|
} else {
|
|
|
req.session.backupCaptch = {
|
|
|
code: verifyCodeImg.text,
|
|
|
verifyResult: false
|
|
|
};
|
|
|
}
|
|
|
|
|
|
res.set('Cache-Control', 'no-cache').send(verifyCodeImg.image);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 发送手机验证码
|
|
|
*/
|
|
|
sendCodeToMobileAPI(req, res, next) {
|
...
|
...
|
|