zac3533 1 سال پیش
والد
کامیت
a5ecd5da86
2فایلهای تغییر یافته به همراه8 افزوده شده و 3 حذف شده
  1. 7 3
      application/api/controller/User.php
  2. 1 0
      application/api/lang/zh-cn/user.php

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

@@ -254,24 +254,28 @@ class User extends Api
 
     public function reset_pwd()
     {
+        $code           = $this->request->post('code');
         $mobile         = $this->request->post('mobile');
         $new_pwd        = $this->request->post("new_pwd", '', null);
         $confirm_pwd    = $this->request->post("confirm_pwd", '', null);
         $rule = [
+            'code'          => 'require',
             'mobile'        => 'require|regex:^1\d{10}$',
             'new_pwd'       => 'require|regex:\S{6,30}',
             'confirm_pwd'   => 'require|regex:\S{6,30}|confirm:new_pwd',
         ];
         $msg = [
-            'mobile.mobile'   => __('Mobile is incorrect'), 
+  
             'new_pwd.confirm' => __('Password and confirm password don\'t match')
         ];
         $data = [
+            'code'        => $code,
             'mobile'        => $mobile,
             'new_pwd'       => $new_pwd,
             'confirm_pwd'   => $confirm_pwd,
         ];
         $field = [
+            'code'          => __('区号'),
             'mobile'        => __('手机号码'),
             'new_pwd'       => __('新资金密码'),
             'confirm_pwd'   => __('新密码')
@@ -281,12 +285,12 @@ class User extends Api
         if (!$result) {
             $this->error(__($validate->getError()));
         }
-        dump(111);die;
+ 
         Db::startTrans();
         try {
             $salt = Random::alnum();
             $new_password = $this->auth->getEncryptPassword($new_pwd, $salt);
-            UserModel::where('mobile', $mobile)
+            UserModel::where('mobile', $mobile)->where('code', $code)
                 ->update([
                     'login_pwd' => $new_password,
                     'salt' => $salt

+ 1 - 0
application/api/lang/zh-cn/user.php

@@ -47,5 +47,6 @@ return [
     '资金密码重置成功'                        => '资金密码重置成功',
     '资金密码重置失败'                        => '资金密码重置失败',
     '手机号码'                               => '手机号码',
+    '区号'                                   => '区号'
 
 ];