mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-12-02 13:32:43 -05:00
* Fix current password requirement during password changes Regression from #9358 (follow-up, PR not present in a stable/versioned release) Fix [GHSA-5vxm-62pg-frff](https://github.com/FreshRSS/FreshRSS/security/advisories/GHSA-5vxm-62pg-frff) * Remove stale client side bcrypt comment from passwordUtil * docs: PHP 8.1 is no longer supported * Minor typographic preference --------- Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
24 lines
554 B
PHP
24 lines
554 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
class FreshRSS_password_Util {
|
|
public const BCRYPT_COST = 9;
|
|
|
|
/**
|
|
* Return a hash of a plain password, using BCRYPT
|
|
*/
|
|
public static function hash(#[\SensitiveParameter] string $passwordPlain): string {
|
|
$passwordHash = password_hash(
|
|
$passwordPlain,
|
|
PASSWORD_BCRYPT,
|
|
['cost' => self::BCRYPT_COST]
|
|
);
|
|
return $passwordHash;
|
|
}
|
|
|
|
public static function cryptAvailable(): bool {
|
|
$hash = '$2y$04$usesomesillystringfore7hnbRJHxXVLeakoG8K30oukPsA.ztMG';
|
|
return $hash === @crypt('password', $hash);
|
|
}
|
|
}
|