From 715005ec96bc3208c3afb917cca3c3eb2d3aabc7 Mon Sep 17 00:00:00 2001 From: fowr <89118232+perdedora@users.noreply.github.com> Date: Wed, 16 Apr 2025 14:44:37 -0300 Subject: [PATCH] auth.php: no need to repass version anymore in test_password --- inc/mod/auth.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/inc/mod/auth.php b/inc/mod/auth.php index c77e1ed2..e5bd6548 100644 --- a/inc/mod/auth.php +++ b/inc/mod/auth.php @@ -55,7 +55,7 @@ function crypt_password($password) { return [ $version, $r ]; } -function test_password(string $db_hash, string|int $version, string $input_password): array { +function test_password(string $db_hash, string|int $version, string $input_password): bool { // Version = 0 denotes an old password hashing schema. In the same column, the // password hash was kept previously $version = (int)$version; @@ -65,7 +65,7 @@ function test_password(string $db_hash, string|int $version, string $input_passw $pre_hash = \hash('tiger160,3', $input_password, false); $ok = \password_verify($pre_hash, $db_hash); } - return [ $version, $ok ]; + return $ok; } function generate_salt() { @@ -80,7 +80,7 @@ function login($username, $password) { $query->execute() or error(db_error($query)); if ($user = $query->fetch(PDO::FETCH_ASSOC)) { - list($version, $ok) = test_password($user['password'], $user['version'], $password); + $ok = test_password($user['password'], $user['version'], $password); if ($ok) { if ((int)$user['version'] < 2) {