namespace Shaarli\Front\Controller\Admin;
-use Shaarli\Container\ShaarliContainer;
use Shaarli\Front\Controller\Visitor\ShaarliVisitorController;
-use Shaarli\Front\Exception\UnauthorizedException;
use Shaarli\Front\Exception\WrongTokenException;
use Shaarli\Security\SessionManager;
use Slim\Http\Request;
*/
abstract class ShaarliAdminController extends ShaarliVisitorController
{
- public function __construct(ShaarliContainer $container)
- {
- parent::__construct($container);
-
- if (true !== $this->container->loginManager->isLoggedIn()) {
- throw new UnauthorizedException();
- }
- }
-
/**
* Any persistent action to the config or data store must check the XSRF token validity.
*/
- protected function checkToken(Request $request): void
+ protected function checkToken(Request $request): bool
{
if (!$this->container->sessionManager->checkToken($request->getParam('token'))) {
throw new WrongTokenException();
}
+
+ return true;
}
/**