Authored by whb

找回密码

@@ -67,27 +67,29 @@ class BackController extends WebAction { @@ -67,27 +67,29 @@ class BackController extends WebAction {
67 $phoneNum = $this->post ('phoneNum', ''); 67 $phoneNum = $this->post ('phoneNum', '');
68 $area = intval ($this->post('area', '86')); 68 $area = intval ($this->post('area', '86'));
69 $verifyCode = $this->post('verifyCode', '');//图形验证码 69 $verifyCode = $this->post('verifyCode', '');//图形验证码
  70 + $ret = false;
70 if (Helpers::verifyEmail($phoneNum)) { // 验证邮箱 71 if (Helpers::verifyEmail($phoneNum)) { // 验证邮箱
71 $email = $phoneNum; 72 $email = $phoneNum;
72 $data = BackData::sendCodeToEmail($email); 73 $data = BackData::sendCodeToEmail($email);
73 if ($data ['code'] == 200) { 74 if ($data ['code'] == 200) {
  75 + $ret = true;
74 $this->setSession('email', $email); 76 $this->setSession('email', $email);
75 return $this->redirect ('sendemail'); 77 return $this->redirect ('sendemail');
76 - } else {  
77 - return $this->redirect ('index');  
78 - }  
79 - 78 + }
80 } else if (Helpers::verifyMobile($phoneNum)) { // 验证手机号 79 } else if (Helpers::verifyMobile($phoneNum)) { // 验证手机号
81 $mobile = $phoneNum; 80 $mobile = $phoneNum;
82 $data = BackData::sendCodeToMobile($mobile, $area); 81 $data = BackData::sendCodeToMobile($mobile, $area);
83 if ($data['code'] == 200) { 82 if ($data['code'] == 200) {
  83 + $ret = true;
84 $this->setSession ('mobile', $mobile ); 84 $this->setSession ('mobile', $mobile );
85 $this->setSession ('area', $area ); 85 $this->setSession ('area', $area );
86 $this->setSession ('verifyCode', $verifyCode ); 86 $this->setSession ('verifyCode', $verifyCode );
87 return $this->redirect ('verification'); 87 return $this->redirect ('verification');
88 - } else {  
89 - return $this->redirect ('index');  
90 - } 88 + }
  89 + }
  90 +
  91 + if(!$ret) {//重新找回密码页
  92 + return $this->redirect('index');
91 } 93 }
92 } 94 }
93 95
@@ -184,6 +186,7 @@ class BackController extends WebAction { @@ -184,6 +186,7 @@ class BackController extends WebAction {
184 $code = $this->post('code');//加密code兼容以前参数 186 $code = $this->post('code');//加密code兼容以前参数
185 $password = $this->post('pwd'); 187 $password = $this->post('pwd');
186 $info = $this->checkCode($code); 188 $info = $this->checkCode($code);
  189 + $ret = false;
187 if (Helpers::verifyPassword ($password)) { 190 if (Helpers::verifyPassword ($password)) {
188 if(!empty($info)) { //手机号找回 191 if(!empty($info)) { //手机号找回
189 // 修改密码 192 // 修改密码
@@ -193,18 +196,22 @@ class BackController extends WebAction { @@ -193,18 +196,22 @@ class BackController extends WebAction {
193 $area = $info ['area']; 196 $area = $info ['area'];
194 $data = BackData::modifyPasswordByMobile($mobile, $token, $password, $area); 197 $data = BackData::modifyPasswordByMobile($mobile, $token, $password, $area);
195 if ($data ['code'] == 200) { 198 if ($data ['code'] == 200) {
196 - return $this->redirect ( 'resetsuccess' ); 199 + $ret = true;
197 } 200 }
198 } else if (isset ($info ['uid'])) { //其他方式修改密码,跳到找回密码首页 201 } else if (isset ($info ['uid'])) { //其他方式修改密码,跳到找回密码首页
199 - return $this->redirect ( 'index' ); 202 + $ret = false;
200 } 203 }
201 } else { //新版邮箱修改接口 204 } else { //新版邮箱修改接口
202 $data = BackData::modifyPasswordByEmailCode($code, $password); 205 $data = BackData::modifyPasswordByEmailCode($code, $password);
203 if ($data ['code'] == 200) { 206 if ($data ['code'] == 200) {
204 - return $this->redirect ('resetsuccess'); 207 + $ret = true;
205 } 208 }
206 } 209 }
207 - } else { 210 + }
  211 + if($ret) { //跳转到成功页
  212 + return $this->redirect ('resetsuccess');
  213 + }
  214 + else {
208 // 跳转错误页面 215 // 跳转错误页面
209 return $this->redirect('index'); 216 return $this->redirect('index');
210 } 217 }