summaryrefslogtreecommitdiff
path: root/localwebsite/handlers/RequestHandler.php
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2022-05-26 21:18:29 +0300
committerEvgeny Zinoviev <me@ch1p.io>2022-05-27 01:04:47 +0300
commitcf0b9f036b3e3eb218610e7eeececda1320d9f50 (patch)
tree39e6d1853aecb3fb77036a941a4c6df12a0ce793 /localwebsite/handlers/RequestHandler.php
parentc3ed2483ea508141431be74f29f7c209271897cd (diff)
auth
Diffstat (limited to 'localwebsite/handlers/RequestHandler.php')
-rw-r--r--localwebsite/handlers/RequestHandler.php11
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