function AutoLoginUrlGeneral::getSecret in Auto Login URL 8
Same name and namespace in other branches
- 2.x src/AutoLoginUrlGeneral.php \Drupal\auto_login_url\AutoLoginUrlGeneral::getSecret()
Get secret key for ALU or create now.
File
- src/
AutoLoginUrlGeneral.php, line 68
Class
- AutoLoginUrlGeneral
- Class AutoLoginUrlGeneral.
Namespace
Drupal\auto_login_urlCode
function getSecret() {
$config = \Drupal::config('auto_login_url.settings');
// Check if it exists.
$secret = $config
->get('secret');
// Create if it does not exist.
if ($secret == '') {
$random_generator = new Random();
$secret = $random_generator
->name(64);
\Drupal::configFactory()
->getEditable('auto_login_url.settings')
->set('secret', $secret)
->save();
}
return $secret;
}