summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-01-26 21:09:47 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-01-26 21:09:47 +0100
commit3fd1e051a736b26606b1f7118c0643102835a325 (patch)
tree01cdf41bf5603dae3376469b8a15b9140e8ca667
parent7a510af73a0ef04ce09fb7eedd98c844e7bff51c (diff)
Compatibilité PHP 5.4-
https://github.com/marienfressinaud/FreshRSS/issues/327#issuecomment-33328377
-rw-r--r--p/i/install.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/p/i/install.php b/p/i/install.php
index 331eda4ff..5addfb527 100644
--- a/p/i/install.php
+++ b/p/i/install.php
@@ -4,7 +4,7 @@ if (function_exists('opcache_reset')) {
}
require('../../constants.php');
-const BCRYPT_COST = 9;
+define('BCRYPT_COST', 9);
include(LIB_PATH . '/lib_rss.php');
@@ -170,6 +170,9 @@ function saveStep2 () {
$_SESSION['default_user'] = substr(preg_replace('/[^a-zA-Z0-9]/', '', $_POST['default_user']), 0, 16);
$_SESSION['auth_type'] = $_POST['auth_type'];
if (!empty($_POST['passwordPlain'])) {
+ if (!function_exists('password_hash')) {
+ include_once(LIB_PATH . '/password_compat.php');
+ }
$passwordHash = password_hash($_POST['passwordPlain'], PASSWORD_BCRYPT, array('cost' => BCRYPT_COST));
$passwordHash = preg_replace('/^\$2[xy]\$/', '\$2a\$', $passwordHash); //Compatibility with bcrypt.js
$_SESSION['passwordHash'] = $passwordHash;