back-new.js 1.41 KB
const _ = require('lodash');
const co = Promise.coroutine;
const backService = require('../models/back-service');

class BackNew {
    /**
     * 通过手机找回密码
     */
    backByMobile(req, res, next) {
        _.set(req.session, 'backupCaptch.verifyResult', false);

        if (req.session.captchaValidCount == null) { // eslint-disable-line
            req.session.captchaValidCount = 5;
        }

        co(function* () {
            let countrysResult = yield backService.getAreaDataAsync(); // 地区信息列表
            let countrys = _.get(countrysResult, 'data', []);

            res.render('back/mobile-new', {
                width750: true,
                localCss: true,
                module: 'passport',
                page: 'back-mobile-new',
                countrys: countrys,
            });
        })().catch(next);
    }

    /**
     * 通过邮箱找回密码
     */
    backByEmail(req, res) {
        res.render('back/email-new', {
            width750: true,
            localCss: true,
            module: 'passport',
            page: 'back-email-new'
        });
    }

    /**
     * 通过邮箱找回密码成功页
     */
    backByEmailSuccess(req, res) {
        res.render('back/email-success-new', {
            width750: true,
            localCss: true,
            module: 'passport',
            page: 'back-email-success-new'
        });
    }
}

module.exports = BackNew;