From 42b1d6f5d532c9f8423b8f83530191dd7372e906 Mon Sep 17 00:00:00 2001 From: sro0 <35873310+sro0@users.noreply.github.com> Date: Tue, 16 Jan 2024 20:45:31 +0100 Subject: [PATCH] Check for argon2 support before using constant PASSWORD_ARGON2X --- lib/Froxlor/Api/Commands/EmailAccounts.php | 8 ++++---- tests/Emails/EmailsTest.php | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Froxlor/Api/Commands/EmailAccounts.php b/lib/Froxlor/Api/Commands/EmailAccounts.php index e560fd0dd4..d8799dedec 100644 --- a/lib/Froxlor/Api/Commands/EmailAccounts.php +++ b/lib/Froxlor/Api/Commands/EmailAccounts.php @@ -157,10 +157,10 @@ public function add() // prefix hash-algo switch (Settings::Get('system.passwordcryptfunc')) { - case PASSWORD_ARGON2I: + case defined('PASSWORD_ARGON2I') && PASSWORD_ARGON2I: $cpPrefix = '{ARGON2I}'; break; - case PASSWORD_ARGON2ID: + case defined('PASSWORD_ARGON2ID') && PASSWORD_ARGON2ID: $cpPrefix = '{ARGON2ID}'; break; default: @@ -404,10 +404,10 @@ public function update() $password = Crypt::validatePassword($password, true); // prefix hash-algo switch (Settings::Get('system.passwordcryptfunc')) { - case PASSWORD_ARGON2I: + case defined('PASSWORD_ARGON2I') && PASSWORD_ARGON2I: $cpPrefix = '{ARGON2I}'; break; - case PASSWORD_ARGON2ID: + case defined('PASSWORD_ARGON2ID') && PASSWORD_ARGON2ID: $cpPrefix = '{ARGON2ID}'; break; default: diff --git a/tests/Emails/EmailsTest.php b/tests/Emails/EmailsTest.php index a62b3ee005..64b812da24 100644 --- a/tests/Emails/EmailsTest.php +++ b/tests/Emails/EmailsTest.php @@ -426,10 +426,10 @@ public function testCustomerEmailAccountsAdd() $this->assertEquals(1, $result['popaccountid']); switch (Settings::Get('system.passwordcryptfunc')) { - case PASSWORD_ARGON2I: + case defined('PASSWORD_ARGON2I') && PASSWORD_ARGON2I: $cpPrefix = '{ARGON2I}'; break; - case PASSWORD_ARGON2ID: + case defined('PASSWORD_ARGON2ID') && PASSWORD_ARGON2ID: $cpPrefix = '{ARGON2ID}'; break; default: