router.js
2.29 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/**
* 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 reg = require(cRoot + '/reg');
const router = express.Router(); // eslint-disable-line
router.get('/autosign/wechat', login.wechat.beforeLogin, login.wechat.login); // 微信登录, 兼容 PHP 的路径
router.get('/login/wechat/callback', login.wechat.callback);
/**
* 注册页面路由
*/
router.get('/reg/index', reg.index);
/**
* 找回密码首页信息
*/
// 找回密码首页
router.get('/back/index', Back.index);
// 实时验证输入是否正确
router.post('/back/authcode',
Captcha.requiredAPI,
Back.validateInputAPI,
Back.getUserInfoAPI);
// 提交按钮邮件API
router.post('/back/email',
// Captcha.requiredPage,
Back.validateUserPage,
Back.sendCodePage,
Back.saveInSession);
// 提交按钮手机API
router.post('/back/mobile',
Captcha.requiredPage,
Back.validateUserPage,
Back.sendCodePage,
Back.saveInSession);
/**
* 邮件找回密码
*/
// 发送邮件成功页面
router.get('/back/sendEmail',
Back.validateEmailInSession,
Back.sendEmailPage);
/**
* 短信找回密码
*/
// 验证手机短信页面
router.get('/back/verification',
// Back.validateMobileInSession,
// Captcha.requiredPage,
Back.verifyCodeByMobilePage);
// 重新发送短信接口
router.post('/back/sendBackMobile',
// Captcha.requiredAPI,
Back.validateMobileAPI,
Back.sendBackMobileAPI);
// 验证手机验证码接口
router.post('/back/backMobile',
// Captcha.requiredAPI,
Back.verifyCodeByMobileAPI);
/**
* 重置密码
*/
// 重置密码页面
router.get('/back/backcode',
Back.validateExistCodePage,
Back.validateCodeByMobilePage,
Back.validateCodeByEmailPage,
Back.resetPasswordPage);
// 重置密码接口
router.post('/back/update',
Back.validateExistCodePage,
Back.validateCodeByMobilePage,
Back.validatePwdPage,
Back.updatePwdAPI);
// 重置密码成功页面
router.get('/back/resetSuccess',
// Back.checkSuccessStatusPage,
Back.resetPwdSuccessPage);
module.exports = router;