mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-25 14:54:24 +02:00
Do not require the openssl extension
This commit is contained in:
parent
79493592bb
commit
2bb7217d04
@ -47,7 +47,12 @@ class SetupCommand extends Command
|
|||||||
*/
|
*/
|
||||||
public function generateTokenAction()
|
public function generateTokenAction()
|
||||||
{
|
{
|
||||||
$token = bin2hex(openssl_random_pseudo_bytes(8));
|
if (function_exists('openssl_random_pseudo_bytes')) {
|
||||||
|
$token = bin2hex(openssl_random_pseudo_bytes(8));
|
||||||
|
} else {
|
||||||
|
$token = substr(md5(mt_rand()), 16);
|
||||||
|
}
|
||||||
|
|
||||||
$filepath = $this->app->getConfigDir() . '/setup.token';
|
$filepath = $this->app->getConfigDir() . '/setup.token';
|
||||||
|
|
||||||
if (false === file_put_contents($filepath, $token)) {
|
if (false === file_put_contents($filepath, $token)) {
|
||||||
|
@ -144,7 +144,12 @@ class DbUserBackend extends UserBackend
|
|||||||
*/
|
*/
|
||||||
protected function generateSalt()
|
protected function generateSalt()
|
||||||
{
|
{
|
||||||
return openssl_random_pseudo_bytes(self::SALT_LENGTH);
|
if (function_exists('openssl_random_pseudo_bytes')) {
|
||||||
|
return openssl_random_pseudo_bytes(self::SALT_LENGTH);
|
||||||
|
} else {
|
||||||
|
// If you know a more secure way to generate a salt, do not hesitate to change this!
|
||||||
|
return substr(md5(mt_rand()), self::SALT_LENGTH);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user