diff --git a/app/admin/controller/system/User.php b/app/admin/controller/system/User.php index 0bf1a8b1f0204f393752b8cac5c0baa49eabbbd5..57651307abe3311bdbc3fc6be743ce7c7dd83ccb 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']) {