ユーザーは存在したらも、ログインが失敗したらエラーを発生する

This commit is contained in:
2025-12-12 12:39:53 +09:00
parent 83a6d5c3de
commit 6d6fa82fcf
2 changed files with 10 additions and 6 deletions

View File

@@ -41,11 +41,15 @@ class User {
if (!$res->isSuccess) { if (!$res->isSuccess) {
$error = $res->message; $error = $res->message;
} else { } else {
$auth->setToken($a[0], $a[1]); $result = $auth->setToken($a[0], $a[1]);
if (!$result->isSuccess) {
$error = $result->message;
} else {
header('Location: /'); header('Location: /');
exit(); exit();
} }
} }
}
$tmpl = new Template('/'); $tmpl = new Template('/');
$pagetit = 'サインイン'; $pagetit = 'サインイン';
$description = 'サイトにサインイン'; $description = 'サイトにサインイン';

View File

@@ -113,9 +113,9 @@ function to_money($amount, $lang) {
} }
function randstr(): string { function randstr(): string {
srand(floor(time() / (60*60*24))); srand((int)floor(time() / (60*60*24)));
$len = rand() % 20; $len = rand(1, 20);
return bin2hex(random_bytes($len / 2)); return bin2hex(random_bytes($len));
} }
function assert_null(mixed $assertion, Throwable|string|null $description = null): bool { function assert_null(mixed $assertion, Throwable|string|null $description = null): bool {