router.js 1.4 KB
/**
 * router of sub app channel
 * @author: Bi Kai<kai.bi@yoho.cn>
 * @date: 2016/05/09
 */

'use strict';

const express = require('express');
const cRoot = './controllers';
const login = require(cRoot + '/login');

const captcha = require(cRoot + '/captcha');
const back = require(cRoot + '/back');

const router = express.Router(); // eslint-disable-line

router.get('/login/wechat', login.wechat.beforeLogin, login.wechat.login); // 登录
router.get('/login/wechat/callback', login.wechat.callback);

// 找回密码首页
router.get('/back/index.html'.back.indexPage);

// 实时验证输入是否正确
router.post('/back/authcode', captcha.checkAPI, back.validateUserInputAPI, back.getUserInfoAPI);
router.post('/back/email', captcha.checkPage, back.sendCodeAPI);


// 邮件重置密码
router.get('/back/backcode.html', back.authRequest, back.checkEmailCodePage, back.resetPasswordByEmailPage);

// 邮件重置密码成功页面
router.get('/back/resetSuccess.html', back.checkSuccessStatusPage, back.resetPwdSuccessPage);

// 重新发送短信
router.post('/back/sendBackMobile', captcha.checkAPI, back.sendBackMobileAPI);
router.get('/back/verification.html', back.verifyCodeByMobilePage);
router.post('/back/backMobile', captcha.checkAPI, back.verifyCodyByMobileAPI);

// 手机更新密码页面
router.post('/back/update', back.authRequest, back.validationPwdPage, back.updatePwdPage);

module.exports = router;