Authored by whb

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

@@ -14,11 +14,10 @@ var $sc = $('#send-captcha'), @@ -14,11 +14,10 @@ var $sc = $('#send-captcha'),
14 itime; 14 itime;
15 15
16 $sc.click(function() { 16 $sc.click(function() {
17 - $.post('/passport/register/authcode', { 17 + $.post('/passport/back/sendbackmobile', {
18 mobile: $('#mobile').val(), 18 mobile: $('#mobile').val(),
19 area: $('#area').val(), 19 area: $('#area').val(),
20 - captcha: $('#captchaPic').val(),  
21 - project: 'repassword' 20 + verifyCode: $('#captchaPic').val(),
22 }, function(jsonData) { 21 }, function(jsonData) {
23 if (jsonData.code === 200) { 22 if (jsonData.code === 200) {
24 $errTip.hide(); 23 $errTip.hide();
@@ -75,6 +75,23 @@ class BackController extends WebAction { @@ -75,6 +75,23 @@ class BackController extends WebAction {
75 } 75 }
76 76
77 /** 77 /**
  78 + * 发送找回手机号短信
  79 + *
  80 + * @return json
  81 + */
  82 + public function sendbackmobileAction()
  83 + {
  84 + $mobile = $this->post ('mobile', '');
  85 + $area = intval ($this->post( 'area', '86' ));
  86 + $verifyCode = $this->post ('verifyCode', '');
  87 + $data = array('code' => 400, 'message' =>'验证失败');
  88 + if(Helpers::verifyMobile($mobile) && PassportModel::verifyCode($verifyCode)) { // 验证手机号
  89 + $data = BackData::sendCodeToMobile($mobile, $area);
  90 + }
  91 + echo $this->echoJson($data);
  92 + }
  93 +
  94 + /**
78 * 发送邮件页面 95 * 发送邮件页面
79 */ 96 */
80 public function sendemailAction() { 97 public function sendemailAction() {
@@ -193,6 +210,7 @@ class BackController extends WebAction { @@ -193,6 +210,7 @@ class BackController extends WebAction {
193 $area = $this->post ( 'area' ); 210 $area = $this->post ( 'area' );
194 $verifyCode = $this->post ( 'verifyCode' ); 211 $verifyCode = $this->post ( 'verifyCode' );
195 $code = $this->post ( 'code' ); // code 212 $code = $this->post ( 'code' ); // code
  213 + $data = array('code'=> 400, 'message' => '验证码错误!','data' => SITE_MAIN.'/passport/back/index');
196 if ($this->getSession ( 'mobile' ) == $mobile && $this->getSession ( 'area' ) == $area) { 214 if ($this->getSession ( 'mobile' ) == $mobile && $this->getSession ( 'area' ) == $area) {
197 $result = BackData::validateMobileCode ( $mobile, $code, $area ); 215 $result = BackData::validateMobileCode ( $mobile, $code, $area );
198 if ($result ['code'] == 200) { 216 if ($result ['code'] == 200) {
@@ -204,12 +222,12 @@ class BackController extends WebAction { @@ -204,12 +222,12 @@ class BackController extends WebAction {
204 ) ); 222 ) );
205 $code = AuthCode::encode ( $str, PassportModel::BACK_FIND_SECRET_KEY ); 223 $code = AuthCode::encode ( $str, PassportModel::BACK_FIND_SECRET_KEY );
206 $url = '/passport/back/backcode?code=' . base64_encode ( $code ); 224 $url = '/passport/back/backcode?code=' . base64_encode ( $code );
207 - $this->redirect ( SITE_MAIN . $url );  
208 - return true; 225 + $data ['code'] = 200;
  226 + $data['message'] = '验证成功';
  227 + $data['data'] = SITE_MAIN . $url;
209 } 228 }
210 } 229 }
211 - //出错直接跳到找回密码页  
212 - $this->redirect ('/passport/back/index'); 230 + $this->echoJson($data);
213 } 231 }
214 232
215 /** 233 /**