Skip to content

Commit

Permalink
Merge branch 'master' of github.com:kuaifan/dootask into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
kuaifan committed Dec 10, 2021
2 parents 4a451ad + 27984ce commit 0fe89c3
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
12 changes: 3 additions & 9 deletions app/Http/Controllers/Api/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ public function editdata()
{
$user = User::auth();
$data = Request::all();
$user->checkSystem(1);
//头像
if (Arr::exists($data, 'userimg')) {
$userimg = Request::input('userimg');
Expand Down Expand Up @@ -267,6 +268,7 @@ public function editdata()
public function editpass()
{
$user = User::auth();
$user->checkSystem();
//
$oldpass = trim(Request::input('oldpass'));
$newpass = trim(Request::input('newpass'));
Expand All @@ -279,15 +281,6 @@ public function editpass()
return Base::retError('新旧密码一致');
}
//
if (env("PASSWORD_ADMIN") == 'disabled') {
if ($user->userid == 1) {
return Base::retError('当前环境禁止修改密码');
}
}
if (env("PASSWORD_OWNER") == 'disabled') {
return Base::retError('当前环境禁止修改密码');
}
//
$verify = User::whereUserid($user->userid)->wherePassword(Base::md52($oldpass, User::token2encrypt()))->count();
if (empty($verify)) {
return Base::retError('请填写正确的旧密码');
Expand Down Expand Up @@ -462,6 +455,7 @@ public function operation()
if (empty($userInfo)) {
return Base::retError('会员不存在或已被删除');
}
$userInfo->checkSystem(1);
//
$upArray = [];
switch ($type) {
Expand Down
18 changes: 18 additions & 0 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,24 @@ public function identity($identity)
}
}

/**
* 检查环境是否允许
* @param null $onlyUserid 仅指定会员
*/
public function checkSystem($onlyUserid = null)
{
if ($onlyUserid && $onlyUserid != $this->userid) {
return;
}
if (env("PASSWORD_ADMIN") == 'disabled') {
if ($this->userid == 1) {
throw new ApiException('当前环境禁止此操作');
}
}
if (env("PASSWORD_OWNER") == 'disabled') {
throw new ApiException('当前环境禁止此操作');
}
}

/** ***************************************************************************************** */
/** ***************************************************************************************** */
Expand Down
2 changes: 2 additions & 0 deletions resources/assets/js/pages/manage/components/DialogView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ export default {
},
}).then(({data}) => {
this.read_list = data;
}).catch(() => {
this.read_list = [];
});
},
Expand Down
2 changes: 2 additions & 0 deletions resources/assets/js/pages/manage/dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ export default {
url: 'system/get/appinfo',
}).then(({data}) => {
this.downList = data.list;
}).catch(() => {
this.downList = [];
});
},
Expand Down

0 comments on commit 0fe89c3

Please sign in to comment.