瀏覽代碼

修改密码提示

zac3533 1 年之前
父節點
當前提交
23020256c8
共有 1 個文件被更改,包括 6 次插入4 次删除
  1. 6 4
      application/api/controller/User.php

+ 6 - 4
application/api/controller/User.php

@@ -95,14 +95,14 @@ class User extends Api
         $old_pwd        = $this->request->post("old_pwd", '', null);
         $new_pwd        = $this->request->post("new_pwd", '', null);
         $confirm_pwd    = $this->request->post("confirm_pwd", '', null);
-
         $rule = [
             'old_pwd'       => 'require|regex:\S{6,30}',
             'new_pwd'       => 'require|regex:\S{6,30}',
             'confirm_pwd'   => 'require|regex:\S{6,30}|confirm:new_pwd',
         ];
-
         $msg = [
+            'old_pwd.regex' => __('Password must be 6 to 30 characters'),
+            'new_pwd.regex' => __('Password must be 6 to 30 characters'),
             'new_pwd.confirm' => __('Password and confirm password don\'t match')
         ];
         $data = [
@@ -120,7 +120,6 @@ class User extends Api
         if (!$result) {
             $this->error(__($validate->getError()));
         }
-
         $ret = $this->auth->changepwd($new_pwd, $old_pwd);
         if ($ret) {
             $this->success(__('Reset password successful'));
@@ -167,6 +166,8 @@ class User extends Api
         ];
 
         $msg = [
+            'login_pwd.regex' => __('Password must be 6 to 30 characters'),
+            'new_pwd.regex' => __('Password must be 6 to 30 characters'),
             'new_pwd.confirm' => __('Password and confirm password don\'t match')
         ];
         $data = [
@@ -265,7 +266,8 @@ class User extends Api
             'confirm_pwd'   => 'require|regex:\S{6,30}|confirm:new_pwd',
         ];
         $msg = [
-  
+            'mobile.regex' => __('Mobile is incorrect'),
+            'new_pwd.regex' => __('Password must be 6 to 30 characters'),
             'new_pwd.confirm' => __('Password and confirm password don\'t match')
         ];
         $data = [