mirror of
https://github.com/flarum/framework.git
synced 2024-12-02 23:23:52 +08:00
Merge pull request #787 from sijad/401-page
401 for unauthorised request to settings, notifications page
This commit is contained in:
commit
28b5ab620b
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Forum\Controller;
|
||||
|
||||
use Flarum\Core\User;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Flarum\Core\Exception\PermissionDeniedException;
|
||||
|
||||
class AuthorizedClientController extends ClientController
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function render(Request $request)
|
||||
{
|
||||
if (!$request->getAttribute('session')->get('user_id')) {
|
||||
throw new PermissionDeniedException;
|
||||
}
|
||||
|
||||
return parent::render($request);
|
||||
}
|
||||
}
|
|
@ -80,13 +80,13 @@ class ForumServiceProvider extends AbstractServiceProvider
|
|||
$routes->get(
|
||||
'/settings',
|
||||
'settings',
|
||||
$toController('Flarum\Forum\Controller\ClientController')
|
||||
$toController('Flarum\Forum\Controller\AuthorizedClientController')
|
||||
);
|
||||
|
||||
$routes->get(
|
||||
'/notifications',
|
||||
'notifications',
|
||||
$toController('Flarum\Forum\Controller\ClientController')
|
||||
$toController('Flarum\Forum\Controller\AuthorizedClientController')
|
||||
);
|
||||
|
||||
$routes->get(
|
||||
|
|
Loading…
Reference in New Issue
Block a user