diff options
Diffstat (limited to 'localwebsite/handlers/RequestHandler.php')
-rw-r--r-- | localwebsite/handlers/RequestHandler.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/localwebsite/handlers/RequestHandler.php b/localwebsite/handlers/RequestHandler.php index 2fffdc0..136a23e 100644 --- a/localwebsite/handlers/RequestHandler.php +++ b/localwebsite/handlers/RequestHandler.php @@ -15,6 +15,12 @@ class RequestHandler extends request_handler { $this->tpl->add_static('polyfills.js'); $this->tpl->add_static('app.js'); $this->tpl->add_static('app.css'); + + if (auth::id()) { + $this->tpl->set_global([ + 'auth_user' => auth::$authorizedUser + ]); + } } public function dispatch(string $act) { @@ -38,4 +44,9 @@ class RequestHandler extends request_handler { ajax_error('unknown act "'.$act.'"', 404); } + + protected function before_dispatch(string $method, string $act) { + if (config::get('auth_need') && !auth::id()) + redirect('/auth/'); + } }
\ No newline at end of file |