Browse Source

国外手机号格式不定,去掉判断

lizhen_gitee 1 năm trước cách đây
mục cha
commit
086c784e38
2 tập tin đã thay đổi với 12 bổ sung12 xóa
  1. 1 1
      application/api/controller/Sms.php
  2. 11 11
      application/api/controller/User.php

+ 1 - 1
application/api/controller/Sms.php

@@ -91,7 +91,7 @@ class Sms extends Api
         $event = $event ? $event : 'register';
         $captcha = $this->request->post("captcha");
 
-        if (!$mobile || !\think\Validate::regex($mobile, "^1\d{10}$")) {
+        if (!$mobile) {
             $this->error(__('手机号不正确'));
         }
         if ($event) {

+ 11 - 11
application/api/controller/User.php

@@ -80,9 +80,9 @@ class User extends Api
         if (!$mobile || !$captcha) {
             $this->error(__('Invalid parameters'));
         }
-        if (!Validate::regex($mobile, "^1\d{10}$")) {
+        /*if (!Validate::regex($mobile, "^1\d{10}$")) {
             $this->error(__('Mobile is incorrect'));
-        }
+        }*/
         if (!Sms::check($mobile, $captcha, 'mobilelogin')) {
             $this->error(__('Captcha is incorrect'));
         }
@@ -137,9 +137,9 @@ class User extends Api
         if ($email && !Validate::is($email, "email")) {
             $this->error(__('Email is incorrect'));
         }
-        if ($mobile && !Validate::regex($mobile, "^1\d{10}$")) {
-            $this->error(__('Mobile is incorrect'));
-        }
+        //if ($mobile && !Validate::regex($mobile, "^1\d{10}$")) {
+        //    $this->error(__('Mobile is incorrect'));
+        //}
         $ret = Sms::check($mobile, $code, 'register');
         if (!$ret) {
             $this->error(__('Captcha is incorrect'));
@@ -508,9 +508,9 @@ class User extends Api
         if (!$oldcaptcha || !$mobile || !$captcha) {
             $this->error(__('Invalid parameters'));
         }
-        if (!Validate::regex($mobile, "^1\d{10}$")) {
+        /*if (!Validate::regex($mobile, "^1\d{10}$")) {
             $this->error(__('Mobile is incorrect'));
-        }
+        }*/
         if($user->mobile == $mobile){
             $this->error('新手机号不能与旧手机号相同');
         }
@@ -554,9 +554,9 @@ class User extends Api
         if (!$mobile || !$captcha) {
             $this->error(__('Invalid parameters'));
         }
-        if (!Validate::regex($mobile, "^1\d{10}$")) {
+        /*if (!Validate::regex($mobile, "^1\d{10}$")) {
             $this->error(__('Mobile is incorrect'));
-        }
+        }*/
         if (\app\common\model\User::where('mobile', $mobile)->find()) {
             $this->error('该手机号已被其他用户绑定');
         }
@@ -625,9 +625,9 @@ class User extends Api
             $this->error(__('Invalid parameters'));
         }
         if ($type == 'mobile') {
-            if (!Validate::regex($mobile, "^1\d{10}$")) {
+            /*if (!Validate::regex($mobile, "^1\d{10}$")) {
                 $this->error(__('Mobile is incorrect'));
-            }
+            }*/
             $user = \app\common\model\User::getByMobile($mobile);
             if (!$user) {
                 $this->error(__('User not found'));