summaryrefslogtreecommitdiff
path: root/localwebsite/classes/auth.php
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2022-05-27 01:13:40 +0300
committerEvgeny Zinoviev <me@ch1p.io>2022-05-27 01:13:40 +0300
commitf1276e23d8ccf873c4c95f1e01db7f394e82c868 (patch)
treed2f64839262c24d46579ca55f60c4a6e275f5dda /localwebsite/classes/auth.php
parentcf0b9f036b3e3eb218610e7eeececda1320d9f50 (diff)
change auth cookie and some related hls stuff
Diffstat (limited to 'localwebsite/classes/auth.php')
-rw-r--r--localwebsite/classes/auth.php12
1 files changed, 3 insertions, 9 deletions
diff --git a/localwebsite/classes/auth.php b/localwebsite/classes/auth.php
index 2cdee72..a13843b 100644
--- a/localwebsite/classes/auth.php
+++ b/localwebsite/classes/auth.php
@@ -4,25 +4,19 @@ class auth {
public static ?User $authorizedUser = null;
- const SESSION_TIMEOUT = 86400 * 365;
- const COOKIE_NAME = 'auth';
+ const COOKIE_NAME = 'lws-auth';
public static function getToken(): ?string {
return $_COOKIE[self::COOKIE_NAME] ?? null;
}
public static function setToken(string $token) {
- setcookie(self::COOKIE_NAME,
- $token,
- time() + self::SESSION_TIMEOUT,
- '/',
- config::get('auth_cookie_host'),
- true);
+ setcookie_safe(self::COOKIE_NAME, $token);
}
public static function resetToken() {
if (!headers_sent())
- setcookie(self::COOKIE_NAME, null, -1, '/', config::get('auth_cookie_host'));
+ unsetcookie(self::COOKIE_NAME);
}
public static function id(bool $do_check = true): int {