router.js
4.57 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/**
* 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 bind = require(cRoot + '/bind');
const router = express.Router(); // eslint-disable-line
// 本地登录
router.get('/login', login.common.beforeLogin, login.local.loginPage);
router.post('/login/auth', login.local.login);
// router.post('/login/user', back.validateInputAPI, back.getUserInfoAPI);
router.get('/logout', login.local.logout);
// 手机短信验证码
router.post('/login/sms/send', captcha.requiredAPI, login.local.sms.send); // 发短信验证码
router.post('/login/sms/auth', login.local.sms.auth); // 验证短信验证码
router.post('/login/sms/checkuser', login.local.sms.checkUser); // 短信检查用户是否注册
// 微信登录
router.get('/autosign/wechat', login.common.beforeLogin, login.wechat.login);
router.get('/login/wechat/callback', login.wechat.callback);
// sina登录
router.get('/autosign/sina', login.common.beforeLogin, login.sina.login);
router.get('/login/sina/callback', login.sina.callback);
// qq登录
router.get('/autosign/qq', login.common.beforeLogin, login.qq.login);
router.get('/login/qq/callback', login.qq.callback);
// alipay登录
router.get('/autosign/alipay', login.common.beforeLogin, login.alipay.login);
router.get('/login/alipay/callback', login.alipay.callback);
router.get('/login/account', login.common.needCaptcha);
// 第三方登录后绑定
router.get('/thirdlogin/index', bind.indexPage);
router.get('/thirdlogin/bindsetpwd', bind.bindSetPwdPage);
// 第三方登录后绑定确认
router.get('/thirdlogin/bindConfirm', bind.bindConfirmPage);
router.get('/thirdlogin/bindSuccess', bind.bindSuccessPage);
// 第三方登录后关联确认
router.get('/thirdlogin/relateConfirm', bind.relateConfirmPage);
router.get('/thirdlogin/relateSuccess', bind.relateSuccessPage);
// 第三方已经绑定
router.get('/thirdlogin/bindedPage', bind.bindedPage);
// 第三方登录api
router.post('/autouserinfo/bindMobile', bind.bindMobile);
router.post('/autouserinfo/bindCheck', bind.bindCheck);
router.post('/autouserinfo/sendBindMsg', bind.sendBindMsg);
router.post('/autouserinfo/checkBindMsg', bind.checkBindMsg);
router.post('/autouserinfo/relateMobile', bind.relateMobile);
/**
* 注册页面路由
*/
router.get('/reg', reg.index);
// router.post('/reg/checkmobile', reg.checkMobile);
router.post('/reg/piccaptcha', reg.checkCode, reg.picCaptcha);
router.post('/reg/msgcaptcha', reg.msgCaptcha);
router.post('/reg/sendBindMsg', reg.checkCode, reg.sendBindMsg);
router.post('/reg/mobileregister', reg.checkPassword, reg.checkCode, reg.mobileRegister);
router.get('/reg/success', reg.success);
/**
* 找回密码首页信息
*/
// 找回密码首页
router.get('/back/index', back.indexPage);
// 实时验证输入是否正确
// router.post('/back/authcode',
// back.validateInputAPI,
// back.getUserInfoAPI);
// 提交按钮邮件API
router.post('/back/email',
captcha.requiredPage,
back.validateInputPage,
back.sendCodePage,
back.saveInSession);
// 提交按钮手机API
router.post('/back/mobile',
captcha.requiredPage,
back.validateInputPage,
back.sendCodePage,
back.saveInSession);
/**
* 邮件找回密码
*/
// 发送邮件成功页面
router.get('/back/sendEmail',
back.validateEmailInSession,
back.sendEmailPage);
/**
* 短信找回密码
*/
// 验证手机短信页面
router.get('/back/verification',
back.validateMobileInSession,
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.validateSuccessStatusPage,
back.resetPwdSuccessPage);
router.get('/images', captcha.generate);
router.post('/images/check', captcha.requiredPost);
module.exports = router;