Authored by whb

找回密码

... ... @@ -67,27 +67,29 @@ class BackController extends WebAction {
$phoneNum = $this->post ('phoneNum', '');
$area = intval ($this->post('area', '86'));
$verifyCode = $this->post('verifyCode', '');//图形验证码
$ret = false;
if (Helpers::verifyEmail($phoneNum)) { // 验证邮箱
$email = $phoneNum;
$data = BackData::sendCodeToEmail($email);
if ($data ['code'] == 200) {
$ret = true;
$this->setSession('email', $email);
return $this->redirect ('sendemail');
} else {
return $this->redirect ('index');
}
}
} else if (Helpers::verifyMobile($phoneNum)) { // 验证手机号
$mobile = $phoneNum;
$data = BackData::sendCodeToMobile($mobile, $area);
if ($data['code'] == 200) {
$ret = true;
$this->setSession ('mobile', $mobile );
$this->setSession ('area', $area );
$this->setSession ('verifyCode', $verifyCode );
return $this->redirect ('verification');
} else {
return $this->redirect ('index');
}
}
}
if(!$ret) {//重新找回密码页
return $this->redirect('index');
}
}
... ... @@ -184,6 +186,7 @@ class BackController extends WebAction {
$code = $this->post('code');//加密code兼容以前参数
$password = $this->post('pwd');
$info = $this->checkCode($code);
$ret = false;
if (Helpers::verifyPassword ($password)) {
if(!empty($info)) { //手机号找回
// 修改密码
... ... @@ -193,18 +196,22 @@ class BackController extends WebAction {
$area = $info ['area'];
$data = BackData::modifyPasswordByMobile($mobile, $token, $password, $area);
if ($data ['code'] == 200) {
return $this->redirect ( 'resetsuccess' );
$ret = true;
}
} else if (isset ($info ['uid'])) { //其他方式修改密码,跳到找回密码首页
return $this->redirect ( 'index' );
$ret = false;
}
} else { //新版邮箱修改接口
$data = BackData::modifyPasswordByEmailCode($code, $password);
if ($data ['code'] == 200) {
return $this->redirect ('resetsuccess');
$ret = true;
}
}
} else {
}
if($ret) { //跳转到成功页
return $this->redirect ('resetsuccess');
}
else {
// 跳转错误页面
return $this->redirect('index');
}
... ...