Authored by whb

修改手机号找回密码发送校验

... ... @@ -14,11 +14,10 @@ var $sc = $('#send-captcha'),
itime;
$sc.click(function() {
$.post('/passport/register/authcode', {
$.post('/passport/back/sendbackmobile', {
mobile: $('#mobile').val(),
area: $('#area').val(),
captcha: $('#captchaPic').val(),
project: 'repassword'
verifyCode: $('#captchaPic').val(),
}, function(jsonData) {
if (jsonData.code === 200) {
$errTip.hide();
... ...
... ... @@ -75,6 +75,23 @@ class BackController extends WebAction {
}
/**
* 发送找回手机号短信
*
* @return json
*/
public function sendbackmobileAction()
{
$mobile = $this->post ('mobile', '');
$area = intval ($this->post( 'area', '86' ));
$verifyCode = $this->post ('verifyCode', '');
$data = array('code' => 400, 'message' =>'验证失败');
if(Helpers::verifyMobile($mobile) && PassportModel::verifyCode($verifyCode)) { // 验证手机号
$data = BackData::sendCodeToMobile($mobile, $area);
}
echo $this->echoJson($data);
}
/**
* 发送邮件页面
*/
public function sendemailAction() {
... ... @@ -193,6 +210,7 @@ class BackController extends WebAction {
$area = $this->post ( 'area' );
$verifyCode = $this->post ( 'verifyCode' );
$code = $this->post ( 'code' ); // code
$data = array('code'=> 400, 'message' => '验证码错误!','data' => SITE_MAIN.'/passport/back/index');
if ($this->getSession ( 'mobile' ) == $mobile && $this->getSession ( 'area' ) == $area) {
$result = BackData::validateMobileCode ( $mobile, $code, $area );
if ($result ['code'] == 200) {
... ... @@ -204,12 +222,12 @@ class BackController extends WebAction {
) );
$code = AuthCode::encode ( $str, PassportModel::BACK_FIND_SECRET_KEY );
$url = '/passport/back/backcode?code=' . base64_encode ( $code );
$this->redirect ( SITE_MAIN . $url );
return true;
$data ['code'] = 200;
$data['message'] = '验证成功';
$data['data'] = SITE_MAIN . $url;
}
}
//出错直接跳到找回密码页
$this->redirect ('/passport/back/index');
$this->echoJson($data);
}
/**
... ...