...
|
...
|
@@ -8,18 +8,14 @@ use Hood\Core\Security\AuthCode; |
|
|
*/
|
|
|
class BackController extends AbstractAction
|
|
|
{
|
|
|
public function indexAction()
|
|
|
{
|
|
|
echo '密码找回';
|
|
|
}
|
|
|
|
|
|
public function emailAction()
|
|
|
{
|
|
|
$data = array(
|
|
|
'backUrl' => 'm.yohobuy.com',
|
|
|
'backUrl' => '/passport/login/index',
|
|
|
'headerText' => '找回密码',
|
|
|
'isPassportPage' => true,
|
|
|
'modulePath' => 'passport/back/email'
|
|
|
'backEmail' => true
|
|
|
);
|
|
|
|
|
|
$this->_view->assign('title', 'YOHO!有货');
|
...
|
...
|
@@ -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,
|
|
|
'modulePath' => 'passport/back/email-success',
|
|
|
'goEmail' => '',
|
|
|
'resendUrl' => ''
|
|
|
'backEmailSuccess' => true,
|
|
|
'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);// 前端不需要判断结果
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -89,7 +109,7 @@ class BackController extends AbstractAction |
|
|
// 处理地区信息
|
|
|
foreach ($areas as &$val) {
|
|
|
$val['areaCode'] = $val['area'];
|
|
|
if($val['area'] == 86)
|
|
|
if($val['area'] === '86')
|
|
|
{
|
|
|
$val['selected'] = true;
|
|
|
}
|
...
|
...
|
@@ -104,12 +124,12 @@ class BackController extends AbstractAction |
|
|
|
|
|
return ($a['id'] < $b['id'] ? -1 : 1);
|
|
|
});*/
|
|
|
|
|
|
|
|
|
$data = array(
|
|
|
'backUrl' => 'm.yohobuy.com',
|
|
|
'backUrl' => '/passport/login/index',
|
|
|
'headerText' => '找回密码',
|
|
|
'isPassportPage' => true,
|
|
|
'modulePath' => 'passport/back/mobile',
|
|
|
'backMobile' => true,
|
|
|
'countrys' => $areas,
|
|
|
'countryCode' => '+86'
|
|
|
);
|
...
|
...
|
@@ -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);
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -139,13 +159,13 @@ class BackController extends AbstractAction |
|
|
{
|
|
|
$mobile = $this->get('mobile', '');
|
|
|
$area = $this->get('area', 86);
|
|
|
$areacode = '+'.$area;
|
|
|
|
|
|
$data = array(
|
|
|
'backUrl' => 'm.yohobuy.com',
|
|
|
'backUrl' => '/passport/back/mobile',
|
|
|
'headerText' => '找回密码',
|
|
|
'isPassportPage' => true,
|
|
|
'modulePath' => 'passport/back/code',
|
|
|
'areaCode' => '+86',
|
|
|
'areaCode' => $areacode,
|
|
|
'phoneNum' => $mobile
|
|
|
);
|
|
|
|
...
|
...
|
@@ -158,41 +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' => 'm.yohobuy.com',
|
|
|
'backUrl' => '/passport/login/index',
|
|
|
'headerText' => '找回密码',
|
|
|
'isPassportPage' => true,
|
|
|
'modulePath' => 'passport/back/new-password',
|
|
|
'pageHeader' => array(
|
|
|
'navBack' => 'm.yohobuy.com',
|
|
|
'navHome' => 'm.yohobuy.com',
|
|
|
'navTitle' => '上衣'
|
|
|
),
|
|
|
'pageFooter' => array(
|
|
|
'loginUrl' => 'm.yohobuy.com/login.html',
|
|
|
'signupUrl' => 'm.yohobuy.com/signup.html'
|
|
|
)
|
|
|
'backNewPwd' => true,
|
|
|
'mobile' => $mobile,
|
|
|
'token' => $token,
|
|
|
'areaCode' => $area,
|
|
|
'code' => $code
|
|
|
);
|
|
|
|
|
|
$this->_view->assign('title', 'YOHO!有货');
|
...
|
...
|
@@ -208,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 |
...
|
...
|
|