mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
Ensure that the auth key is always available
This commit is contained in:
parent
2227e0d278
commit
85396efcf9
2 changed files with 40 additions and 0 deletions
|
|
@ -50,10 +50,45 @@ class adminAdminView extends admin
|
|||
|
||||
$this->makeGnbUrl();
|
||||
|
||||
// Check system configuration
|
||||
$this->checkSystemConfiguration();
|
||||
|
||||
// Retrieve the list of installed modules
|
||||
$this->checkEasyinstall();
|
||||
}
|
||||
|
||||
/**
|
||||
* check system configuration
|
||||
* @return void
|
||||
*/
|
||||
function checkSystemConfiguration()
|
||||
{
|
||||
$changed = false;
|
||||
|
||||
// Check encryption keys.
|
||||
if (config('crypto.encryption_key') === null)
|
||||
{
|
||||
config('crypto.encryption_key', Rhymix\Framework\Security::getRandom(64, 'alnum'));
|
||||
$changed = true;
|
||||
}
|
||||
if (config('crypto.authentication_key') === null)
|
||||
{
|
||||
config('crypto.authentication_key', Rhymix\Framework\Security::getRandom(64, 'alnum'));
|
||||
$changed = true;
|
||||
}
|
||||
if (config('crypto.session_key') === null)
|
||||
{
|
||||
config('crypto.session_key', Rhymix\Framework\Security::getRandom(64, 'alnum'));
|
||||
$changed = true;
|
||||
}
|
||||
|
||||
// Save new configuration.
|
||||
if ($changed)
|
||||
{
|
||||
Rhymix\Framework\Config::save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* check easy install
|
||||
* @return void
|
||||
|
|
|
|||
|
|
@ -149,6 +149,11 @@ class installController extends install
|
|||
$config['db']['master']['prefix'] .= '_';
|
||||
}
|
||||
|
||||
// Create new crypto keys.
|
||||
$config['crypto']['encryption_key'] = Rhymix\Framework\Security::getRandom(64, 'alnum');
|
||||
$config['crypto']['authentication_key'] = Rhymix\Framework\Security::getRandom(64, 'alnum');
|
||||
$config['crypto']['session_key'] = Rhymix\Framework\Security::getRandom(64, 'alnum');
|
||||
|
||||
// Set the default language.
|
||||
$config['locale']['default_lang'] = Context::getLangType();
|
||||
$config['locale']['enabled_lang'] = array($config['locale']['default_lang']);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue