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()
|
||||
{
|
||||
$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';
|
||||
|
||||
if (false === file_put_contents($filepath, $token)) {
|
||||
|
|
|
@ -144,7 +144,12 @@ class DbUserBackend extends UserBackend
|
|||
*/
|
||||
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…
Reference in New Issue