1
|
-<?php
|
|
|
2
|
-use Action\WebAction;
|
|
|
3
|
-use LibModels\Web\Passport\RegData;
|
|
|
4
|
-use Passport\PassportModel;
|
|
|
5
|
-use Plugin\Helpers;
|
|
|
6
|
-use LibModels\Wap\Passport\BackData;
|
|
|
7
|
-use Plugin\AuthCode;
|
|
|
8
|
-class BackController extends WebAction {
|
|
|
9
|
-
|
|
|
10
|
- /**
|
|
|
11
|
- * 找回密码
|
|
|
12
|
- */
|
|
|
13
|
- public function indexAction() {
|
|
|
14
|
- $banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
|
|
|
15
|
- $data = array (
|
|
|
16
|
- 'simpleHeader' => PassportModel::getSimpleHeader(false),
|
|
|
17
|
- 'backPage' => true,
|
|
|
18
|
- 'back' => array (
|
|
|
19
|
- 'coverHref' => $banner ['url'],
|
|
|
20
|
- 'coverImg' => $banner ['img'],
|
|
|
21
|
- 'countryCode' => '86',
|
|
|
22
|
- 'countryName' => '中国',
|
|
|
23
|
- 'captchaUrl' => '/passport/images?t=1449799445',
|
|
|
24
|
- 'countryList' => RegData::getAreasData()
|
|
|
25
|
- )
|
|
|
26
|
- );
|
|
|
27
|
- $this->_view->display ( 'index', $data );
|
|
|
28
|
- }
|
|
|
29
|
-
|
|
|
30
|
- /**
|
|
|
31
|
- * 校验验证码
|
|
|
32
|
- */
|
|
|
33
|
- public function authcodeAction() {
|
|
|
34
|
- $phoneNum = $this->post ('phoneNum', '');
|
|
|
35
|
- $area = intval ($this->post( 'area', '86' ));
|
|
|
36
|
- $verifyCode = $this->post ('verifyCode', '');
|
|
|
37
|
- $data = array('code' => 400, 'message' =>'验证失败');
|
|
|
38
|
- if ((Helpers::verifyEmail($phoneNum) || Helpers::verifyMobile($phoneNum))
|
|
|
39
|
- && PassportModel::verifyCode($verifyCode)) {
|
|
|
40
|
- $data['code'] = 200;
|
|
|
41
|
- $data['message'] = '验证成功';
|
|
|
42
|
- }
|
|
|
43
|
- echo $this->echoJson($data);
|
|
|
44
|
- }
|
|
|
45
|
-
|
|
|
46
|
- /**
|
|
|
47
|
- * 邮箱
|
|
|
48
|
- */
|
|
|
49
|
- public function emailAction() {
|
|
|
50
|
- $phoneNum = $this->post ('phoneNum', '');
|
|
|
51
|
- $area = intval ($this->post('area', '86'));
|
|
|
52
|
- $verifyCode = $this->post('verifyCode', '');
|
|
|
53
|
- if (Helpers::verifyEmail($phoneNum)) { // 验证邮箱
|
|
|
54
|
- $email = $phoneNum;
|
|
|
55
|
- $data = BackData::sendCodeToEmail($email);
|
|
|
56
|
-
|
|
|
57
|
- if ($data ['code'] == 200) {
|
|
|
58
|
- $this->setSession('email', $email);
|
|
|
59
|
- $this->redirect ('sendemail');
|
|
|
60
|
- } else {
|
|
|
61
|
- $this->redirect ('index');
|
|
|
62
|
- }
|
|
|
63
|
-
|
|
|
64
|
- } else if (Helpers::verifyMobile($phoneNum)) { // 验证手机号
|
|
|
65
|
- $mobile = $phoneNum;
|
|
|
66
|
- $data = BackData::sendCodeToMobile($mobile, $area);
|
|
|
67
|
- if ($data ['code'] == 200) {
|
|
|
68
|
- $this->setSession ('mobile', $mobile );
|
|
|
69
|
- $this->setSession ('area', $area );
|
|
|
70
|
- $this->setSession ('verifyCode', $verifyCode );
|
|
|
71
|
- $this->redirect ('verification');
|
|
|
72
|
- } else {
|
|
|
73
|
- $this->redirect ('index');
|
|
|
74
|
- }
|
|
|
75
|
- }
|
|
|
76
|
- }
|
|
|
77
|
-
|
|
|
78
|
- /**
|
|
|
79
|
- * 发送邮件页面
|
|
|
80
|
- */
|
|
|
81
|
- public function sendemailAction() {
|
|
|
82
|
- $email = $this->getSession ('email');
|
|
|
83
|
- if (empty ( $email )) {
|
|
|
84
|
- $this->redirect ('index');
|
|
|
85
|
- }
|
|
|
86
|
- $banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
|
|
|
87
|
- $data = array (
|
|
|
88
|
- 'simpleHeader' => PassportModel::getSimpleHeader(false),
|
|
|
89
|
- 'sendEmail' => array (
|
|
|
90
|
- 'coverHref' => $banner ['url'],
|
|
|
91
|
- 'coverImg' => $banner ['img'],
|
|
|
92
|
- 'countrys' => array ()
|
|
|
93
|
- )
|
|
|
94
|
- );
|
|
|
95
|
- $this->_view->display('send-email', $data);
|
|
|
96
|
- }
|
|
|
97
|
-
|
|
|
98
|
- /**
|
|
|
99
|
- * 重置密码页面
|
|
|
100
|
- */
|
|
|
101
|
- public function backcodeAction() {
|
|
|
102
|
- $code = $this->get('code');
|
|
|
103
|
- $info = $this->checkCode($code);
|
|
|
104
|
- if (empty ( $info )) {
|
|
|
105
|
- $this->redirect ('index');
|
|
|
106
|
- }
|
|
|
107
|
- $banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
|
|
|
108
|
- $data = array (
|
|
|
109
|
- 'simpleHeader' => PassportModel::getSimpleHeader(false),
|
|
|
110
|
- 'resetPage' => true,
|
|
|
111
|
- 'resetPwd' => array (
|
|
|
112
|
- 'coverHref' => $banner ['url'],
|
|
|
113
|
- 'coverImg' => $banner ['img'],
|
|
|
114
|
- 'countrys' => array(),
|
|
|
115
|
- 'code' => $code
|
|
|
116
|
- )
|
|
|
117
|
- );
|
|
|
118
|
- $this->_view->display('reset-pwd', $data);
|
|
|
119
|
- }
|
|
|
120
|
-
|
|
|
121
|
- /**
|
|
|
122
|
- * 更新密码接口
|
|
|
123
|
- */
|
|
|
124
|
- public function updateAction() {
|
|
|
125
|
- $code = $this->post('code');
|
|
|
126
|
- $password = $this->post('pwd');
|
|
|
127
|
- $info = $this->checkCode($code);
|
|
|
128
|
- if (Helpers::verifyPassword ($password) && ! empty ($info)) {
|
|
|
129
|
- // 修改密码
|
|
|
130
|
- if (isset ( $info ['mobile'] )) { // 手机号修改密码
|
|
|
131
|
- $mobile = $info ['mobile'];
|
|
|
132
|
- $token = $info ['token'];
|
|
|
133
|
- $area = $info ['area'];
|
|
|
134
|
- $data = BackData::modifyPasswordByMobile($mobile, $token, $password, $area);
|
|
|
135
|
- if ($data ['code'] == 200) {
|
|
|
136
|
- $this->redirect ( 'resetSuccess' );
|
|
|
137
|
- }
|
|
|
138
|
- } else if (isset ($info ['uid'])) { // 其他方式修改密码
|
|
|
139
|
- $uid = $info ['uid'];
|
|
|
140
|
- $this->redirect ( 'resetSuccess' );
|
|
|
141
|
- }
|
|
|
142
|
- }
|
|
|
143
|
- // 跳转错误页面
|
|
|
144
|
- // $this->redirect('/error/index');
|
|
|
145
|
- }
|
|
|
146
|
-
|
|
|
147
|
- /**
|
|
|
148
|
- * 重置密码成功
|
|
|
149
|
- */
|
|
|
150
|
- public function resetSuccessAction() {
|
|
|
151
|
- $banner = PassportModel::getLeftBanner ( PassportModel::BACK_LFFT_BANNER_CODE );
|
|
|
152
|
- $data = array (
|
|
|
153
|
- 'simpleHeader' => PassportModel::getSimpleHeader ( false ),
|
|
|
154
|
- 'resetSuccess' => array (
|
|
|
155
|
- 'coverHref' => $banner ['url'],
|
|
|
156
|
- 'coverImg' => $banner ['img'],
|
|
|
157
|
- 'countrys' => array ()
|
|
|
158
|
- )
|
|
|
159
|
- );
|
|
|
160
|
- $this->_view->display ( 'reset-success', $data );
|
|
|
161
|
- }
|
|
|
162
|
-
|
|
|
163
|
- /**
|
|
|
164
|
- * 手机验证页面
|
|
|
165
|
- */
|
|
|
166
|
- public function verificationAction() {
|
|
|
167
|
- $mobile = $this->getSession ('mobile');
|
|
|
168
|
- $area = $this->getSession ('area');
|
|
|
169
|
- $verifyCode = $this->getSession ('verifyCode');
|
|
|
170
|
- if (empty ($mobile)) {
|
|
|
171
|
- $this->redirect ('index');
|
|
|
172
|
- }
|
|
|
173
|
- $banner = PassportModel::getLeftBanner (PassportModel::BACK_LFFT_BANNER_CODE);
|
|
|
174
|
- $data = array (
|
|
|
175
|
- 'simpleHeader' => PassportModel::getSimpleHeader ( false ),
|
|
|
176
|
- 'vertificationPage' => true,
|
|
|
177
|
- 'verification' => array (
|
|
|
178
|
- 'coverHref' => $banner ['url'],
|
|
|
179
|
- 'coverImg' => $banner ['img'],
|
|
|
180
|
- 'mobile' => $mobile,
|
|
|
181
|
- 'area' => $area,
|
|
|
182
|
- 'verifyCode' => $verifyCode,
|
|
|
183
|
- 'countrys' => array ()
|
|
|
184
|
- )
|
|
|
185
|
- );
|
|
|
186
|
- $this->_view->display ('verification', $data);
|
|
|
187
|
- }
|
|
|
188
|
-
|
|
|
189
|
- /**
|
|
|
190
|
- * 手机找回密码验证
|
|
|
191
|
- */
|
|
|
192
|
- public function backmobileAction() {
|
|
|
193
|
- $mobile = $this->post ( 'mobile' );
|
|
|
194
|
- $area = $this->post ( 'area' );
|
|
|
195
|
- $verifyCode = $this->post ( 'verifyCode' );
|
|
|
196
|
- $code = $this->post ( 'code' ); // code
|
|
|
197
|
- if ($this->getSession ( 'mobile' ) == $mobile && $this->getSession ( 'area' ) == $area) {
|
|
|
198
|
- $result = BackData::validateMobileCode ( $mobile, $code, $area );
|
|
|
199
|
- if ($result ['code'] == 200) {
|
|
|
200
|
- $str = json_encode ( array (
|
|
|
201
|
- 'mobile' => $mobile,
|
|
|
202
|
- 'area' => $area,
|
|
|
203
|
- 'token' => $result ['data'] ['token'],
|
|
|
204
|
- 'create_time' => time ()
|
|
|
205
|
- ) );
|
|
|
206
|
- $code = AuthCode::encode ( $str, PassportModel::BACK_FIND_SECRET_KEY );
|
|
|
207
|
- $url = '/passport/back/backcode?code=' . base64_encode ( $code );
|
|
|
208
|
- $this->redirect ( SITE_MAIN . $url );
|
|
|
209
|
- }
|
|
|
210
|
- }
|
|
|
211
|
- }
|
|
|
212
|
-
|
|
|
213
|
- /**
|
|
|
214
|
- * 检查code
|
|
|
215
|
- *
|
|
|
216
|
- * @param string $code
|
|
|
217
|
- * @return boolean
|
|
|
218
|
- */
|
|
|
219
|
- private function checkCode($code) {
|
|
|
220
|
- $code = base64_decode ( $code );
|
|
|
221
|
- $info = json_decode ( AuthCode::decode ( $code, PassportModel::BACK_FIND_SECRET_KEY ), true );
|
|
|
222
|
- if ($info ['create_time'] < 1 || (time () - $info ['create_time']) > 86400) {
|
|
|
223
|
- return array ();
|
|
|
224
|
- }
|
|
|
225
|
- return $info;
|
|
|
226
|
- }
|
1
|
+<?php
|
|
|
2
|
+use Action\WebAction;
|
|
|
3
|
+use LibModels\Web\Passport\RegData;
|
|
|
4
|
+use Passport\PassportModel;
|
|
|
5
|
+use Plugin\Helpers;
|
|
|
6
|
+use LibModels\Wap\Passport\BackData;
|
|
|
7
|
+use Plugin\AuthCode;
|
|
|
8
|
+class BackController extends WebAction {
|
|
|
9
|
+
|
|
|
10
|
+ /**
|
|
|
11
|
+ * 找回密码
|
|
|
12
|
+ */
|
|
|
13
|
+ public function indexAction() {
|
|
|
14
|
+ $banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
|
|
|
15
|
+ $data = array (
|
|
|
16
|
+ 'simpleHeader' => PassportModel::getSimpleHeader(false),
|
|
|
17
|
+ 'backPage' => true,
|
|
|
18
|
+ 'back' => array (
|
|
|
19
|
+ 'coverHref' => $banner ['url'],
|
|
|
20
|
+ 'coverImg' => $banner ['img'],
|
|
|
21
|
+ 'countryCode' => '86',
|
|
|
22
|
+ 'countryName' => '中国',
|
|
|
23
|
+ 'captchaUrl' => '/passport/images?t=1449799445',
|
|
|
24
|
+ 'countryList' => RegData::getAreasData()
|
|
|
25
|
+ )
|
|
|
26
|
+ );
|
|
|
27
|
+ $this->_view->display ( 'index', $data );
|
|
|
28
|
+ }
|
|
|
29
|
+
|
|
|
30
|
+ /**
|
|
|
31
|
+ * 校验验证码
|
|
|
32
|
+ */
|
|
|
33
|
+ public function authcodeAction() {
|
|
|
34
|
+ $phoneNum = $this->post ('phoneNum', '');
|
|
|
35
|
+ $area = intval ($this->post( 'area', '86' ));
|
|
|
36
|
+ $verifyCode = $this->post ('verifyCode', '');
|
|
|
37
|
+ $data = array('code' => 400, 'message' =>'验证失败');
|
|
|
38
|
+ if ((Helpers::verifyEmail($phoneNum) || Helpers::verifyMobile($phoneNum))
|
|
|
39
|
+ && PassportModel::verifyCode($verifyCode)) {
|
|
|
40
|
+ $data['code'] = 200;
|
|
|
41
|
+ $data['message'] = '验证成功';
|
|
|
42
|
+ }
|
|
|
43
|
+ echo $this->echoJson($data);
|
|
|
44
|
+ }
|
|
|
45
|
+
|
|
|
46
|
+ /**
|
|
|
47
|
+ * 邮箱
|
|
|
48
|
+ */
|
|
|
49
|
+ public function emailAction() {
|
|
|
50
|
+ $phoneNum = $this->post ('phoneNum', '');
|
|
|
51
|
+ $area = intval ($this->post('area', '86'));
|
|
|
52
|
+ $verifyCode = $this->post('verifyCode', '');
|
|
|
53
|
+ if (Helpers::verifyEmail($phoneNum)) { // 验证邮箱
|
|
|
54
|
+ $email = $phoneNum;
|
|
|
55
|
+ $data = BackData::sendCodeToEmail($email);
|
|
|
56
|
+ if ($data ['code'] == 200) {
|
|
|
57
|
+ $this->setSession('email', $email);
|
|
|
58
|
+ $this->redirect ('sendemail');
|
|
|
59
|
+ } else {
|
|
|
60
|
+ $this->redirect ('index');
|
|
|
61
|
+ }
|
|
|
62
|
+
|
|
|
63
|
+ } else if (Helpers::verifyMobile($phoneNum)) { // 验证手机号
|
|
|
64
|
+ $mobile = $phoneNum;
|
|
|
65
|
+ $data = BackData::sendCodeToMobile($mobile, $area);
|
|
|
66
|
+
|
|
|
67
|
+ if ($data['code'] == 200) {
|
|
|
68
|
+ $this->setSession ('mobile', $mobile );
|
|
|
69
|
+ $this->setSession ('area', $area );
|
|
|
70
|
+ $this->setSession ('verifyCode', $verifyCode );
|
|
|
71
|
+ $this->redirect ('verification');
|
|
|
72
|
+ } else {
|
|
|
73
|
+ $this->redirect ('index');
|
|
|
74
|
+ }
|
|
|
75
|
+ }
|
|
|
76
|
+ }
|
|
|
77
|
+
|
|
|
78
|
+ /**
|
|
|
79
|
+ * 发送邮件页面
|
|
|
80
|
+ */
|
|
|
81
|
+ public function sendemailAction() {
|
|
|
82
|
+ $email = $this->getSession ('email');
|
|
|
83
|
+ if (empty ( $email )) {
|
|
|
84
|
+ $this->redirect ('index');
|
|
|
85
|
+ }
|
|
|
86
|
+ $banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
|
|
|
87
|
+ $data = array (
|
|
|
88
|
+ 'simpleHeader' => PassportModel::getSimpleHeader(false),
|
|
|
89
|
+ 'sendEmail' => array (
|
|
|
90
|
+ 'coverHref' => $banner ['url'],
|
|
|
91
|
+ 'coverImg' => $banner ['img'],
|
|
|
92
|
+ 'countrys' => array ()
|
|
|
93
|
+ )
|
|
|
94
|
+ );
|
|
|
95
|
+ $this->_view->display('send-email', $data);
|
|
|
96
|
+ }
|
|
|
97
|
+
|
|
|
98
|
+ /**
|
|
|
99
|
+ * 重置密码页面
|
|
|
100
|
+ */
|
|
|
101
|
+ public function backcodeAction() {
|
|
|
102
|
+ $code = $this->get('code');
|
|
|
103
|
+ $info = $this->checkCode($code);
|
|
|
104
|
+ if (empty ( $info )) {
|
|
|
105
|
+ $this->redirect ('index');
|
|
|
106
|
+ }
|
|
|
107
|
+ $banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
|
|
|
108
|
+ $data = array (
|
|
|
109
|
+ 'simpleHeader' => PassportModel::getSimpleHeader(false),
|
|
|
110
|
+ 'resetPage' => true,
|
|
|
111
|
+ 'resetPwd' => array (
|
|
|
112
|
+ 'coverHref' => $banner ['url'],
|
|
|
113
|
+ 'coverImg' => $banner ['img'],
|
|
|
114
|
+ 'countrys' => array(),
|
|
|
115
|
+ 'code' => $code
|
|
|
116
|
+ )
|
|
|
117
|
+ );
|
|
|
118
|
+ $this->_view->display('reset-pwd', $data);
|
|
|
119
|
+ }
|
|
|
120
|
+
|
|
|
121
|
+ /**
|
|
|
122
|
+ * 更新密码接口
|
|
|
123
|
+ */
|
|
|
124
|
+ public function updateAction() {
|
|
|
125
|
+ $code = $this->post('code');
|
|
|
126
|
+ $password = $this->post('pwd');
|
|
|
127
|
+ $info = $this->checkCode($code);
|
|
|
128
|
+ if (Helpers::verifyPassword ($password) && ! empty ($info)) {
|
|
|
129
|
+ // 修改密码
|
|
|
130
|
+ if (isset ( $info ['mobile'] )) { // 手机号修改密码
|
|
|
131
|
+ $mobile = $info ['mobile'];
|
|
|
132
|
+ $token = $info ['token'];
|
|
|
133
|
+ $area = $info ['area'];
|
|
|
134
|
+ $data = BackData::modifyPasswordByMobile($mobile, $token, $password, $area);
|
|
|
135
|
+ if ($data ['code'] == 200) {
|
|
|
136
|
+ $this->redirect ( 'resetSuccess' );
|
|
|
137
|
+ }
|
|
|
138
|
+ } else if (isset ($info ['uid'])) { // 其他方式修改密码
|
|
|
139
|
+ $uid = $info ['uid'];
|
|
|
140
|
+ $this->redirect ( 'resetSuccess' );
|
|
|
141
|
+ }
|
|
|
142
|
+ }
|
|
|
143
|
+ // 跳转错误页面
|
|
|
144
|
+ // $this->redirect('/error/index');
|
|
|
145
|
+ }
|
|
|
146
|
+
|
|
|
147
|
+ /**
|
|
|
148
|
+ * 重置密码成功
|
|
|
149
|
+ */
|
|
|
150
|
+ public function resetSuccessAction() {
|
|
|
151
|
+ $banner = PassportModel::getLeftBanner ( PassportModel::BACK_LFFT_BANNER_CODE );
|
|
|
152
|
+ $data = array (
|
|
|
153
|
+ 'simpleHeader' => PassportModel::getSimpleHeader ( false ),
|
|
|
154
|
+ 'resetSuccess' => array (
|
|
|
155
|
+ 'coverHref' => $banner ['url'],
|
|
|
156
|
+ 'coverImg' => $banner ['img'],
|
|
|
157
|
+ 'countrys' => array ()
|
|
|
158
|
+ )
|
|
|
159
|
+ );
|
|
|
160
|
+ $this->_view->display ( 'reset-success', $data );
|
|
|
161
|
+ }
|
|
|
162
|
+
|
|
|
163
|
+ /**
|
|
|
164
|
+ * 手机验证页面
|
|
|
165
|
+ */
|
|
|
166
|
+ public function verificationAction() {
|
|
|
167
|
+ $mobile = $this->getSession ('mobile');
|
|
|
168
|
+ $area = $this->getSession ('area');
|
|
|
169
|
+ $verifyCode = $this->getSession ('verifyCode');
|
|
|
170
|
+ if (empty ($mobile)) {
|
|
|
171
|
+ $this->redirect ('index');
|
|
|
172
|
+ }
|
|
|
173
|
+ $banner = PassportModel::getLeftBanner (PassportModel::BACK_LFFT_BANNER_CODE);
|
|
|
174
|
+ $data = array (
|
|
|
175
|
+ 'simpleHeader' => PassportModel::getSimpleHeader ( false ),
|
|
|
176
|
+ 'vertificationPage' => true,
|
|
|
177
|
+ 'verification' => array (
|
|
|
178
|
+ 'coverHref' => $banner ['url'],
|
|
|
179
|
+ 'coverImg' => $banner ['img'],
|
|
|
180
|
+ 'mobile' => $mobile,
|
|
|
181
|
+ 'area' => $area,
|
|
|
182
|
+ 'verifyCode' => $verifyCode,
|
|
|
183
|
+ 'countrys' => array ()
|
|
|
184
|
+ )
|
|
|
185
|
+ );
|
|
|
186
|
+ $this->_view->display ('verification', $data);
|
|
|
187
|
+ }
|
|
|
188
|
+
|
|
|
189
|
+ /**
|
|
|
190
|
+ * 手机找回密码验证
|
|
|
191
|
+ */
|
|
|
192
|
+ public function backmobileAction() {
|
|
|
193
|
+ $mobile = $this->post ( 'mobile' );
|
|
|
194
|
+ $area = $this->post ( 'area' );
|
|
|
195
|
+ $verifyCode = $this->post ( 'verifyCode' );
|
|
|
196
|
+ $code = $this->post ( 'code' ); // code
|
|
|
197
|
+ if ($this->getSession ( 'mobile' ) == $mobile && $this->getSession ( 'area' ) == $area) {
|
|
|
198
|
+ $result = BackData::validateMobileCode ( $mobile, $code, $area );
|
|
|
199
|
+ if ($result ['code'] == 200) {
|
|
|
200
|
+ $str = json_encode ( array (
|
|
|
201
|
+ 'mobile' => $mobile,
|
|
|
202
|
+ 'area' => $area,
|
|
|
203
|
+ 'token' => $result ['data'] ['token'],
|
|
|
204
|
+ 'create_time' => time ()
|
|
|
205
|
+ ) );
|
|
|
206
|
+ $code = AuthCode::encode ( $str, PassportModel::BACK_FIND_SECRET_KEY );
|
|
|
207
|
+ $url = '/passport/back/backcode?code=' . base64_encode ( $code );
|
|
|
208
|
+ $this->redirect ( SITE_MAIN . $url );
|
|
|
209
|
+ }
|
|
|
210
|
+ }
|
|
|
211
|
+ //出错直接跳到找回密码页
|
|
|
212
|
+ $this->redirect ('/passport/back/index');
|
|
|
213
|
+ }
|
|
|
214
|
+
|
|
|
215
|
+ /**
|
|
|
216
|
+ * 检查code
|
|
|
217
|
+ *
|
|
|
218
|
+ * @param string $code
|
|
|
219
|
+ * @return boolean
|
|
|
220
|
+ */
|
|
|
221
|
+ private function checkCode($code) {
|
|
|
222
|
+ $code = base64_decode ( $code );
|
|
|
223
|
+ $info = json_decode ( AuthCode::decode ( $code, PassportModel::BACK_FIND_SECRET_KEY ), true );
|
|
|
224
|
+ if ($info ['create_time'] < 1 || (time () - $info ['create_time']) > 86400) {
|
|
|
225
|
+ return array ();
|
|
|
226
|
+ }
|
|
|
227
|
+ return $info;
|
|
|
228
|
+ }
|
|
|
229
|
+
|
227
|
} |
230
|
} |