...
|
...
|
@@ -8,10 +8,6 @@ use Hood\Core\Security\AuthCode; |
|
|
*/
|
|
|
class BackController extends AbstractAction
|
|
|
{
|
|
|
public function indexAction()
|
|
|
{
|
|
|
echo '密码找回';
|
|
|
}
|
|
|
|
|
|
public function emailAction()
|
|
|
{
|
...
|
...
|
@@ -33,11 +29,30 @@ class BackController extends AbstractAction |
|
|
{
|
|
|
if($this->isAjax())
|
|
|
{
|
|
|
$email = $this->post('email', '');
|
|
|
|
|
|
// 发送邮箱验证码
|
|
|
$result = BackData::sendCodeToEmail($email);
|
|
|
if($result['code'] === 200)
|
|
|
{
|
|
|
$result['data'] = '/passport/back/success?email='.$email;
|
|
|
}
|
|
|
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 重新发送邮箱验证码
|
|
|
*/
|
|
|
public function resendemailAction()
|
|
|
{
|
|
|
if($this->isAjax())
|
|
|
{
|
|
|
$email = $this->get('email', '');
|
|
|
|
|
|
// 发送邮箱验证码
|
|
|
$result = BackData::sendCodeToEmail($email);
|
|
|
$result['data'] = '/passport/back/success';
|
|
|
|
|
|
$this->echoJson($result);
|
|
|
}
|
...
|
...
|
@@ -45,13 +60,18 @@ class BackController extends AbstractAction |
|
|
|
|
|
public function successAction()
|
|
|
{
|
|
|
$email = $this->get('email', '');
|
|
|
// 获取到邮箱域名
|
|
|
$pattern = "/^([0-9A-Za-z\\-_\\.]+)@([0-9a-z]+\\.[a-z]{2,3}(\\.[a-z]{2})?)$/i";
|
|
|
$domain_name = 'http://mail.'.preg_replace( $pattern ,"$2", $email );
|
|
|
|
|
|
$data = array(
|
|
|
'backUrl' => 'm.yohobuy.com',
|
|
|
'backUrl' => '/passport/back/email',
|
|
|
'headerText' => '找回密码',
|
|
|
'isPassportPage' => true,
|
|
|
'backEmailSuccess' => true,
|
|
|
'goEmail' => '',
|
|
|
'resendUrl' => ''
|
|
|
'goEmail' => $domain_name,
|
|
|
'resendUrl' => '/passport/back/resendemail?email='.$email
|
|
|
);
|
|
|
|
|
|
$this->_view->assign('title', 'YOHO!有货');
|
...
|
...
|
@@ -67,12 +87,12 @@ class BackController extends AbstractAction |
|
|
{
|
|
|
if($this->isAjax())
|
|
|
{
|
|
|
$pwd = $this->get('pwd', '');
|
|
|
$code = $this->get('code', '');
|
|
|
$pwd = $this->post('password', '');
|
|
|
$code = $this->post('code', '');
|
|
|
|
|
|
$data = BackData::modifyPasswordByEmail($pwd, $code);
|
|
|
|
|
|
$this->returnJson(200, '成功', '');// 前端不需要判断结果
|
|
|
$this->echoJson($data);// 前端不需要判断结果
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -106,7 +126,7 @@ class BackController extends AbstractAction |
|
|
});*/
|
|
|
|
|
|
$data = array(
|
|
|
'backUrl' => '/passport/back/login',
|
|
|
'backUrl' => '/passport/login/index',
|
|
|
'headerText' => '找回密码',
|
|
|
'isPassportPage' => true,
|
|
|
'backMobile' => true,
|
...
|
...
|
@@ -121,17 +141,17 @@ class BackController extends AbstractAction |
|
|
/**
|
|
|
* 发送手机验证码
|
|
|
*/
|
|
|
public function mobilecodeSendAction()
|
|
|
public function sendcodeAction()
|
|
|
{
|
|
|
if($this->isAjax())
|
|
|
{
|
|
|
$mobile = $this->get('mobile', '');
|
|
|
$area = $this->get('area', 86);
|
|
|
$mobile = $this->post('mobile', '');
|
|
|
$area = $this->post('area', 86);
|
|
|
|
|
|
// 发送手机验证码
|
|
|
$result = BackData::sendCodeToMobile($mobile, $area);
|
|
|
|
|
|
$this->returnJson($result['code'], $result['message'], $result['data']);
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -158,32 +178,40 @@ class BackController extends AbstractAction |
|
|
*
|
|
|
* @return array 校验手机验证码的结果(token)
|
|
|
*/
|
|
|
public function mobilecodeValidateAction()
|
|
|
public function verifycodeAction()
|
|
|
{
|
|
|
if($this->isAjax())
|
|
|
{
|
|
|
$mobile = $this->get('mobile', '');
|
|
|
$code = $this->get('code', '');
|
|
|
$area = $this->get('area', 86);
|
|
|
$mobile = $this->post('mobile', '');
|
|
|
$code = $this->post('code', '');
|
|
|
$area = $this->post('area', 86);
|
|
|
|
|
|
// 校验手机验证码
|
|
|
$result = BackData::validateMobileCode($mobile, $code, $area);
|
|
|
|
|
|
$this->returnJson($result['code'], $result['message'], $result['data']);
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public function passwordAction()
|
|
|
{
|
|
|
$mobile = $this->get('mobile', '');
|
|
|
// 手机验证令牌
|
|
|
$token = $this->get('token', '');
|
|
|
$area = $this->get('area', 86);
|
|
|
|
|
|
// 邮箱验证码
|
|
|
$code = $this->get('code', '');
|
|
|
|
|
|
$data = array(
|
|
|
'backUrl' => '/passport/back/login',
|
|
|
'backUrl' => '/passport/login/index',
|
|
|
'headerText' => '找回密码',
|
|
|
'isPassportPage' => true,
|
|
|
'backNewPwd' => true,
|
|
|
'mobile' => $mobile,
|
|
|
'token' => $token,
|
|
|
'areaCode' => $area,
|
|
|
'code' => $code
|
|
|
);
|
|
|
|
|
|
$this->_view->assign('title', 'YOHO!有货');
|
...
|
...
|
@@ -199,15 +227,15 @@ class BackController extends AbstractAction |
|
|
{
|
|
|
if($this->isAjax())
|
|
|
{
|
|
|
$mobile = $this->get('mobile', '');
|
|
|
$token = $this->get('token', '');
|
|
|
$newpwd = $this->get('newpwd', 86);
|
|
|
$area = $this->get('area', 86);
|
|
|
$mobile = $this->post('mobile', '');
|
|
|
$token = $this->post('token', '');
|
|
|
$newpwd = $this->post('password', '');
|
|
|
$area = $this->post('area', 86);
|
|
|
|
|
|
// 根据手机验证码修改密码
|
|
|
$result = BackData::modifyPasswordByMobile($mobile, $token, $newpwd, $area);
|
|
|
|
|
|
$this->returnJson($result['code'], $result['message'], $result['data']);
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
}
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|