优化会员限制

This commit is contained in:
kuaifan
2021-12-10 06:34:21 +08:00
parent 7ef966536d
commit 7e67fa3076
6 changed files with 42 additions and 9 deletions

View File

@@ -210,6 +210,7 @@ class UsersController extends AbstractController
{
$user = User::auth();
$data = Request::all();
$user->checkSystem(1);
//头像
if (Arr::exists($data, 'userimg')) {
$userimg = Request::input('userimg');
@@ -267,6 +268,7 @@ class UsersController extends AbstractController
public function editpass()
{
$user = User::auth();
$user->checkSystem();
//
$oldpass = trim(Request::input('oldpass'));
$newpass = trim(Request::input('newpass'));
@@ -279,15 +281,6 @@ class UsersController extends AbstractController
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('请填写正确的旧密码');
@@ -462,6 +455,7 @@ class UsersController extends AbstractController
if (empty($userInfo)) {
return Base::retError('会员不存在或已被删除');
}
$userInfo->checkSystem(1);
//
$upArray = [];
switch ($type) {