ic: close website for non-admins

This commit is contained in:
E. S. 2025-04-28 15:39:49 +03:00
parent 0aa77194c3
commit a3850dc679

View File

@ -2,12 +2,22 @@
namespace app\ic;
use engine\http\errors\NotFound;
use engine\http\HtmlResponse;
use engine\http\PlainTextResponse;
class MainHandler
extends BaseHandler
{
protected function beforeDispatch(string $http_method, string $action) {
if (!isAdmin() && $action != 'index')
throw new NotFound();
}
public function GET_index() {
if (!isAdmin())
return new HtmlResponse($this->skin->render('soon.twig'));
return new PlainTextResponse('hello world');
}
}