diff --git a/src/Site/Controller/User.php b/src/Site/Controller/User.php index f0055a4..c2a4898 100644 --- a/src/Site/Controller/User.php +++ b/src/Site/Controller/User.php @@ -41,9 +41,13 @@ class User { if (!$res->isSuccess) { $error = $res->message; } else { - $auth->setToken($a[0], $a[1]); - header('Location: /'); - exit(); + $result = $auth->setToken($a[0], $a[1]); + if (!$result->isSuccess) { + $error = $result->message; + } else { + header('Location: /'); + exit(); + } } } $tmpl = new Template('/'); diff --git a/util.php b/util.php index 65d38a3..85d0ae8 100644 --- a/util.php +++ b/util.php @@ -113,9 +113,9 @@ function to_money($amount, $lang) { } function randstr(): string { - srand(floor(time() / (60*60*24))); - $len = rand() % 20; - return bin2hex(random_bytes($len / 2)); + srand((int)floor(time() / (60*60*24))); + $len = rand(1, 20); + return bin2hex(random_bytes($len)); } function assert_null(mixed $assertion, Throwable|string|null $description = null): bool {