Skip to content

Commit

Permalink
Check for argon2 support before using constant PASSWORD_ARGON2X (#1228)
Browse files Browse the repository at this point in the history
  • Loading branch information
z-e-r-0-t authored and d00p committed Jan 16, 2024
1 parent b34ab45 commit 0315963
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/Froxlor/Api/Commands/EmailAccounts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions tests/Emails/EmailsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 0315963

Please sign in to comment.