Authored by whb

找回密码

... ... @@ -137,7 +137,7 @@
</div>
<div class="gobuy float-left {{gobytype}}" id="miniCartBox">
{{# gobuy}}
<span class="ic-infomation">{{gobuynum}}</span>
<span class="ic-infomation">0</span>
<div class="gobuy-wrapper"></div>
{{/gobuy}}
</div>
... ...
... ... @@ -68,26 +68,27 @@ class BackController extends WebAction {
$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 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');
}
if(PassportModel::verifyCode($verifyCode)) {
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 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');
}
}
}
if(!$ret) {//重新找回密码页
return $this->redirect('index');
}
... ... @@ -150,7 +151,7 @@ class BackController extends WebAction {
$ret = array();
if (!empty ( $info )) {
$verifyState = true;
if(isset($info['uid'])) { //老版修改邮箱密码
if(isset($info['uid'])) { //老版修改邮箱密码不处理
$verifyState = false;//重新找回密码
}
} else {
... ... @@ -187,6 +188,7 @@ class BackController extends WebAction {
$password = $this->post('pwd');
$info = $this->checkCode($code);
$ret = false;
$successType = '';
if (Helpers::verifyPassword ($password)) {
if(!empty($info)) { //手机号找回
// 修改密码
... ... @@ -196,6 +198,7 @@ class BackController extends WebAction {
$area = $info ['area'];
$data = BackData::modifyPasswordByMobile($mobile, $token, $password, $area);
if ($data ['code'] == 200) {
$successType ='mobile';
$ret = true;
}
} else if (isset ($info ['uid'])) { //其他方式修改密码,跳到找回密码首页
... ... @@ -204,11 +207,13 @@ class BackController extends WebAction {
} else { //新版邮箱修改接口
$data = BackData::modifyPasswordByEmailCode($code, $password);
if ($data ['code'] == 200) {
$successType = 'email';
$ret = true;
}
}
}
if($ret) { //跳转到成功页
$this->setSession('successType', $successType);
return $this->redirect ('resetsuccess');
}
else {
... ... @@ -222,6 +227,11 @@ class BackController extends WebAction {
*/
public function resetsuccessAction()
{
$successType = $this->getSession('successType');
//成功状态标识
if(empty($successType)) {
return $this->redirect('index');
}
$banner = PassportModel::getLeftBanner ( PassportModel::BACK_LFFT_BANNER_CODE );
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader (),
... ... @@ -231,6 +241,8 @@ class BackController extends WebAction {
'countrys' => array ()
)
);
//清除标识
$this->setSession('successType', '');
$this->_view->display ( 'reset-success', $data );
}
... ... @@ -242,7 +254,7 @@ class BackController extends WebAction {
$mobile = $this->getSession ('mobile');
$area = $this->getSession ('area');
$verifyCode = $this->getSession ('verifyCode');//图形验证码
if (empty ($mobile)) {
if (empty ($mobile) || !PassportModel::verifyCode($verifyCode)) {
$this->redirect ('index');
}
$banner = PassportModel::getLeftBanner (PassportModel::BACK_LFFT_BANNER_CODE);
... ... @@ -271,7 +283,8 @@ class BackController extends WebAction {
$verifyCode = $this->post ( 'verifyCode' );//图形验证码
$code = $this->post ( 'code' ); //手机验证码
$data = array('code'=> 400, 'message' => '验证码错误!','data' => SITE_MAIN.'/passport/back/index');
if ($this->getSession ( 'mobile' ) == $mobile && $this->getSession ( 'area' ) == $area && ! empty($code)) {
if ($this->getSession ( 'mobile' ) == $mobile && $this->getSession ( 'area' ) == $area && ! empty($code)
&& PassportModel::verifyCode($verifyCode)) {
$result = BackData::validateMobileCode ( $mobile, $code, $area );
if ($result ['code'] == 200) {
$str = json_encode ( array (
... ...