/**
* @param integer $step The requested setup step
* @return void
*/
public function loginAction($step = 0)
{
if ($this->fileBasedSimpleKeyService->keyExists($this->keyName) === false || file_exists($this->settings['initialPasswordFile'])) {
$setupPassword = $this->fileBasedSimpleKeyService->generateKey($this->keyName);
$initialPasswordFileContents = 'The setup password is:' . PHP_EOL;
$initialPasswordFileContents .= PHP_EOL;
$initialPasswordFileContents .= $setupPassword . PHP_EOL;
$initialPasswordFileContents .= PHP_EOL;
$initialPasswordFileContents .= 'After you successfully logged in, this file is automatically deleted for security reasons.' . PHP_EOL;
$initialPasswordFileContents .= 'Make sure to save the setup password for later use.' . PHP_EOL;
$result = file_put_contents($this->settings['initialPasswordFile'], $initialPasswordFileContents);
if ($result === false) {
$this->addFlashMessage('It was not possible to save the initial setup password to file "%s". Check file permissions and retry.', 'Password Generation Failure', Message::SEVERITY_ERROR, [$this->settings['initialPasswordFile']]);
} else {
$this->view->assign('initialPasswordFile', $this->settings['initialPasswordFile']);
}
}
$this->view->assign('step', $step);
}