mirror of
https://github.com/flarum/framework.git
synced 2025-01-19 18:12:59 +08:00
Don't allow guests into the admin area
This commit is contained in:
parent
1286a52e1d
commit
a43957e1e2
|
@ -16,12 +16,11 @@ class LoginWithCookieAndCheckAdmin
|
|||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (($token = $request->cookie('flarum_remember')) &&
|
||||
($accessToken = AccessToken::where('id', $token)->first())) {
|
||||
$user = $accessToken->user;
|
||||
if (! $user->isAdmin()) {
|
||||
die('ur not an admin');
|
||||
}
|
||||
$this->actor->setUser($user);
|
||||
($accessToken = AccessToken::where('id', $token)->first()) &&
|
||||
$accessToken->user->isAdmin()) {
|
||||
$this->actor->setUser($accessToken->user);
|
||||
} else {
|
||||
die('ur not an admin');
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
|
Loading…
Reference in New Issue
Block a user