sms-new.js 1.77 KB
const _ = require('lodash');
const RegService = require('../models/reg-service');
const co = Promise.coroutine;
const LoginNewModel = require('../models/login-new');

class SmsNew {
    smsLoginPage(req, res, next) {
        _.set(req.session, 'smsLogin.step', 1);

        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, 'data[0].data[0].src', '');

            res.render('sms/sms-login-new', {
                module: 'passport',
                page: 'sms-login-new',
                width750: true,
                localCss: true,
                banner: banner,
                countrys: RegService.getAreaData(), // 地区信息列表
                backUrl: 'javascript:history.go(-1)', // eslint-disable-line
                loginUrl: '/passport/login',
                registerUrl: '/passport/reg/index', // 注册的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', // 国际号登录的URL链接
                phoneRetriveUrl: '/passport/back/mobile', // 通过手机号找回密码的URL链接
                emailRetriveUrl: '/passport/back/email', // 通过邮箱找回密码的URL链接
                isWechat: req.yoho.isWechat
            });
        })().catch(next);
    }
}

module.exports = SmsNew;