Эх сурвалжийг харах

重置密码去掉手机验证

Jason 1 жил өмнө
parent
commit
0487ae0ec2

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

@@ -157,7 +157,7 @@ class User extends Api
         $login_pwd      = $this->request->post("login_pwd", '', null);
         $new_pwd        = $this->request->post("new_pwd", '', null);
         $confirm_pwd    = $this->request->post("confirm_pwd", '', null);
-        $captcha        = $this->request->post("captcha");
+        //$captcha        = $this->request->post("captcha");
 
         $rule = [
             'login_pwd'     => 'require|regex:\S{6,30}',
@@ -186,16 +186,20 @@ class User extends Api
             $this->error(__($validate->getError()));
         }
 
-        if (empty($captcha)) {
-            $this->error(__('Invalid parameters'));
-        }
+//        if (empty($captcha)) {
+//            $this->error(__('Invalid parameters'));
+//        }
 
         $user = $this->auth->getUser();
 
         //验证手机验证码
-        $ret = (new \app\api\controller\Sms())->check($user['code'],$user['mobile'], $captcha, 'rest_fund_pwd');
-        if (!$ret) {
-            $this->error(__('Captcha is incorrect'));
+//        $ret = (new \app\api\controller\Sms())->check($user['code'],$user['mobile'], $captcha, 'rest_fund_pwd');
+//        if (!$ret) {
+//            $this->error(__('Captcha is incorrect'));
+//        }
+
+        if ($user['pwd'] != $this->auth->getEncryptPassword($data['login_pwd'], $user['salt'])) {
+            $this->error(__('Password is incorrect'));
         }
 
         $res = (new \app\common\model\Users())