...
|
...
|
@@ -13,6 +13,7 @@ const sign = global.yoho.sign; |
|
|
const cookie = global.yoho.cookie;
|
|
|
const RegService = require('../models/reg-service');
|
|
|
const AuthHelper = require('../models/auth-helper');
|
|
|
const captchaService = require('../models/captcha-service');
|
|
|
|
|
|
let index = (req, res) => {
|
|
|
// 设置注册有效时间30分钟, 防机器刷
|
...
|
...
|
@@ -28,6 +29,7 @@ let index = (req, res) => { |
|
|
page: 'reg',
|
|
|
title: '注册',
|
|
|
backUrl: 'javascript:history.go(-1)', // eslint-disable-line
|
|
|
captchaUrl: helpers.urlFormat('/passport/reg/captcha.png', {t: Date.now()}),
|
|
|
headerText: '注册', // 头部信息
|
|
|
isPassportPage: true, // 模板中模块标识
|
|
|
areaCode: '+86', // 默认的区号
|
...
|
...
|
@@ -269,6 +271,20 @@ let setPassword = (req, res, next) => { |
|
|
}).catch(next);
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 生成 校验码
|
|
|
*/
|
|
|
const genCaptcha = (req, res) => {
|
|
|
let captcha = captchaService.generateCaptcha(90, 52, 4);
|
|
|
|
|
|
req.session.regCaptch = captcha.token;
|
|
|
|
|
|
res.type('png')
|
|
|
.set('Cache-Control', 'no-cache')
|
|
|
.status(200)
|
|
|
.end(captcha.image);
|
|
|
};
|
|
|
|
|
|
module.exports = {
|
|
|
index,
|
|
|
verifyMobile,
|
...
|
...
|
@@ -276,5 +292,6 @@ module.exports = { |
|
|
sendCode,
|
|
|
verifyCode,
|
|
|
password: passwordAction,
|
|
|
setPassword
|
|
|
setPassword,
|
|
|
genCaptcha
|
|
|
}; |
...
|
...
|
|