Redirect to /setup if necessary

A user gets now redirected to /setup in case he is not logged in, the token
file exists and no config.ini was found.

refs #7163
This commit is contained in:
Johannes Meyer 2014-09-10 14:48:33 +02:00
parent 032437cdeb
commit 98fbfe68a8
3 changed files with 36 additions and 0 deletions

View File

@ -33,6 +33,17 @@ class AuthenticationController extends ActionController
*/
public function loginAction()
{
if (@file_exists(Config::$configDir . '/setup.token')) {
try {
$config = Config::app()->toArray();
if (empty($config)) {
$this->redirectNow(Url::fromPath('setup'));
}
} catch (NotReadableError $e) {
// Gets thrown in case of insufficient permission only
}
}
$auth = $this->Auth();
$this->view->form = $form = new LoginForm();
$this->view->title = $this->translate('Icingaweb Login');

View File

@ -0,0 +1,25 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
use Icinga\Web\Controller\ActionController;
class SetupController extends ActionController
{
/**
* Whether the controller requires the user to be authenticated
*
* FALSE as the wizard uses token authentication
*
* @var bool
*/
protected $requiresAuthentication = false;
/**
* Show the web wizard
*/
public function indexAction()
{
}
}