login-new.js
2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
const _ = require('lodash');
const co = Promise.coroutine;
const RegService = require('../models/reg-service');
const LoginNewModel = require('../models/login-new');
class Login {
/**
* 登录页面
*/
loginPage(req, res, next) {
// 是否关闭账号登录
let closePassword = _.get(req.app.locals.wap, 'close.passwordLogin', false);
if (closePassword) {
return res.redirect(`/signin.html?refer=${req.query.refer || ''}`);
}
if (req.session.captchaValidCount == null) { // eslint-disable-line
req.session.captchaValidCount = 5;
}
co(function* () {
let bannerData = yield req.ctx(LoginNewModel).getTopBanner();
let banner = _.get(bannerData, 'result.data[0].data.list[0]', '');
res.render('login/login-new', {
module: 'passport',
page: 'login-new',
localCss: true,
width750: true,
banner: banner,
captchaShow: req.yoho.captchaShow,
backUrl: 'javascript:history.go(-1)', // eslint-disable-line
smsLoginUrl: '/passport/sms_login',
registerUrl: '/passport/reg-new', // 注册的URL链接
aliLoginUrl: '/passport/login/alipay', // 支付宝快捷登录的URL链接
weiboLoginUrl: '/passport/login/sina', // 微博登录的URL链接
qqLoginUrl: '/passport/login/qq', // 腾讯QQ登录的URL链接
wechatLoginUrl: '/passport/login/wechat', // 微信登录的URL链接
internationalUrl: '/passport/international-new', // 国际号登录的URL链接
phoneRetriveUrl: '/passport/back/mobile', // 通过手机号找回密码的URL链接
emailRetriveUrl: '/passport/back/email', // 通过邮箱找回密码的URL链接
});
})().catch(next);
}
/**
* 国际账号登录
*/
international(req, res) {
// 是否关闭账号登录
let closePassword = _.get(req.app.locals.wap, 'close.passwordLogin', false);
if (closePassword) {
return res.redirect(`/signin.html?refer=${req.query.refer || ''}`);
}
if (req.session.captchaValidCount == null) { // eslint-disable-line
req.session.captchaValidCount = 5;
}
res.render('login/international-new', {
module: 'passport',
page: 'international-new',
localCss: true,
width750: true,
captchaShow: req.yoho.captchaShow,
countrys: RegService.getAreaData()
});
}
}
module.exports = Login;