...
|
...
|
@@ -56,6 +56,7 @@ class BackController extends WebAction |
|
|
$data = BackData::sendCodeToMobile($mobile);
|
|
|
$this->setSession('phoneNum', $phoneNum);
|
|
|
$this->setSession('area', $area);
|
|
|
$this->setSession('captcha', $captcha);
|
|
|
if($data['code'] == 200) {
|
|
|
$this->redirect('verification');
|
|
|
}
|
...
|
...
|
@@ -66,7 +67,7 @@ class BackController extends WebAction |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 发送邮件
|
|
|
* 发送邮件页面
|
|
|
*/
|
|
|
public function sendemailAction() {
|
|
|
$phoneNum = $this->getSession('phoneNum');
|
...
|
...
|
@@ -96,14 +97,14 @@ class BackController extends WebAction |
|
|
'sendEmail' => array(
|
|
|
'coverHref' => $banner['url'],
|
|
|
'coverImg' => $banner['img'],
|
|
|
'countrys' => array()
|
|
|
'countrys' => array(),
|
|
|
)
|
|
|
);
|
|
|
$this->_view->display('send-email', $data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 重置密码
|
|
|
* 重置密码页面
|
|
|
*/
|
|
|
public function backcodeAction() {
|
|
|
$code = $this->get('code');
|
...
|
...
|
@@ -118,14 +119,15 @@ class BackController extends WebAction |
|
|
'resetPwd' => array(
|
|
|
'coverHref' => $banner['url'],
|
|
|
'coverImg' => $banner['img'],
|
|
|
'countrys' => array()
|
|
|
'countrys' => array(),
|
|
|
'code' => $code,
|
|
|
)
|
|
|
);
|
|
|
$this->_view->display('reset-pwd', $data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 更新密码
|
|
|
* 更新密码接口
|
|
|
*
|
|
|
*/
|
|
|
public function updateAction()
|
...
|
...
|
@@ -134,10 +136,22 @@ class BackController extends WebAction |
|
|
$password = $this->post('pwd');
|
|
|
$info = $this->checkCode($code);
|
|
|
if(Helpers::verifyPassword($password) && !empty($info)) {
|
|
|
$uid = $info['uid'];
|
|
|
//修改密码
|
|
|
if(isset($info['mobile'])) {//手机号修改密码
|
|
|
$mobile = $info['mobile'];
|
|
|
$token = $info['token'];
|
|
|
$area = $info['area'];
|
|
|
$data = BackData::modifyPasswordByMobile($mobile, $token, $password, $area);
|
|
|
if($data['code']) {
|
|
|
$this->redirect('resetSuccess');
|
|
|
}
|
|
|
} else if(isset($info['uid'])) {//其他方式修改密码
|
|
|
$uid = $info['uid'];
|
|
|
$this->redirect('resetSuccess');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//跳转错误页面
|
|
|
$this->redirect('/error/index');
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -157,14 +171,15 @@ class BackController extends WebAction |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 手机验证
|
|
|
* 手机验证页面
|
|
|
*/
|
|
|
public function verificationAction() {
|
|
|
$phoneNum = $this->getSession('phoneNum');
|
|
|
$area = $this->getSession('area');
|
|
|
// if(empty($phoneNum)) {
|
|
|
// $this->redirect('index');
|
|
|
// }
|
|
|
$captcha = $this->getSession('captcha');
|
|
|
if(empty($phoneNum)) {
|
|
|
$this->redirect('index');
|
|
|
}
|
|
|
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
|
|
|
$data = array(
|
|
|
'simpleHeader' => PassportModel::getSimpleHeader(false),
|
...
|
...
|
@@ -174,6 +189,7 @@ class BackController extends WebAction |
|
|
'coverImg' => $banner['img'],
|
|
|
'phoneNum' => $phoneNum,
|
|
|
'area' => $area,
|
|
|
'captcha'=> $captcha,
|
|
|
'countrys' => array()
|
|
|
)
|
|
|
);
|
...
|
...
|
@@ -181,6 +197,32 @@ class BackController extends WebAction |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 手机找回密码验证
|
|
|
*/
|
|
|
public function backmobileAction()
|
|
|
{
|
|
|
$mobile = $this->post('mobile');//phoneNum
|
|
|
$area = $this->post('area');
|
|
|
//$captcha = $this->post('captcha');
|
|
|
$code = $this->post('captcha');//code
|
|
|
if($this->getSession('phoneNum') == $mobile && $this->getSession('area') == $area)
|
|
|
{
|
|
|
$result = BackData::validateMobileCode($mobile, $code, $area);
|
|
|
if($result['code'] == 200) {
|
|
|
$str = json_encode(array(
|
|
|
'mobile'=> $mobile,
|
|
|
'area' => $area,
|
|
|
'token'=> $result['data']['token'],
|
|
|
'create_time' => time()
|
|
|
));
|
|
|
$code = AuthCode::encode($str, PassportModel::BACK_FIND_SECRET_KEY);
|
|
|
$url = '/passport/back/backcode?code='.base64_encode($code);
|
|
|
$this->redirect(SITE_MAIN.$url);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 检查code
|
|
|
*
|
|
|
* @param string $code
|
...
|
...
|
@@ -188,9 +230,8 @@ class BackController extends WebAction |
|
|
*/
|
|
|
private function checkCode($code)
|
|
|
{
|
|
|
$key = '_+@#$%^';
|
|
|
$code = base64_decode($code);
|
|
|
$info = json_decode(AuthCode::decode($code, $key), true);
|
|
|
$info = json_decode(AuthCode::decode($code, PassportModel::BACK_FIND_SECRET_KEY), true);
|
|
|
if ($info['create_time'] < 1 || (time() - $info['create_time']) > 86400) {
|
|
|
return array();
|
|
|
}
|
...
|
...
|
|