From ac5e9bf7c56d0b02b65e5068fda9dec6602352ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=9B=BE=E5=9B=BE?= <209766828@qq.com> Date: Tue, 10 May 2022 07:10:02 +0000 Subject: [PATCH] =?UTF-8?q?update=20app/admin/controller/system/User.php.?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9=E5=AF=86=E7=A0=81=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/system/User.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/admin/controller/system/User.php b/app/admin/controller/system/User.php index 0bf1a8b1..57651307 100644 --- a/app/admin/controller/system/User.php +++ b/app/admin/controller/system/User.php @@ -15,6 +15,8 @@ namespace app\admin\controller\system; use app\AdminController; use app\common\model\system\User as UserModel; use app\common\model\system\UserGroup as UserGroupModel; +use system\Random; + class User extends AdminController { @@ -118,6 +120,18 @@ class User extends AdminController if (empty($post) || !is_array($post)) { return $this->error($post); } + + //判断是否修改密码 + if($post['pwd'] != '' && $post['pwd'] != $post['pwd2']){ + return $this->error('两次输入密码不同'); + } + if ($post["pwd"] == '' && $post["pwd2"] == '') { + unset($post['pwd']); + } else { + $post["salt"] = Random::alpha(); + $post['pwd'] = encryptPwd($post['pwd'],$post["salt"]); + } + // 查询数据 $data = $this->model->find($post['id']); if ($data['nickname'] != $post['nickname']) { -- Gitee