This commit is contained in:
xiaomlove
2021-12-14 16:22:03 +08:00
parent 19d7e048df
commit 3fa8fd19c0
29 changed files with 319 additions and 45 deletions

View File

@@ -16,7 +16,7 @@ class AuthenticateRepository extends BaseRepository
if (!$user || md5($user->secret . $password . $user->secret) != $user->passhash) {
throw new \InvalidArgumentException('Username or password invalid.');
}
if (!$user->canAccessAdmin()) {
if (IS_PLATFORM_ADMIN && !$user->canAccessAdmin()) {
throw new UnauthorizedException('Unauthorized!');
}
$tokenName = __METHOD__ . __LINE__;