Skip to content

Commit

Permalink
0020912: login.php no longer redirects already authenticated users to…
Browse files Browse the repository at this point in the history
… the starting page
  • Loading branch information
smeyer-ilias committed Aug 30, 2017
1 parent b6d5738 commit 931e3c3
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
44 changes: 44 additions & 0 deletions Services/Init/classes/class.ilStartUpGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,50 @@ public function jumpToPasswordAssistance()
$this->executeCommand();
}

/**
* Show login page or redirect to startup page if user is not authenticated.
*/
protected function showLoginPageOrStartupPage()
{
/**
* @var ilAuthSession
*/
$auth_session = $GLOBALS['DIC']['ilAuthSession'];

if(strcmp($_REQUEST['cmd'], 'force_login') === 0)
{
$this->logger->debug('Force login');
if($auth_session->isValid())
{
$this->logger->debug('Valid session -> logout current user');
ilSession::setClosingContext(ilSession::SESSION_CLOSE_USER);
$auth_session->logout();

$GLOBALS['ilAppEventHandler']->raise(
'Services/Authentication',
'afterLogout',
array(
'username' => $GLOBALS['DIC']->user()->getLogin()
)
);
}
$this->logger->debug('Show login page');
return $this->showLoginPage();
}

/**
* @var ilAuthSession
*/
if($auth_session->isValid())
{
$this->logger->debug('Valid session -> redirect to starting page');
return ilInitialisation::redirectToStartingPage();
}
$this->logger->debug('No valid session -> show login');
$this->showLoginPage();
}


/**
* @todo check for forced authentication like ecs, ...
* Show login page
Expand Down
2 changes: 1 addition & 1 deletion login.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
ilInitialisation::initILIAS();

$ilCtrl->initBaseClass("ilStartUpGUI");
$ilCtrl->setCmd('showLoginPage');
$ilCtrl->setCmd('showLoginPageOrStartupPage');
$ilCtrl->setTargetScript("ilias.php");
$ilCtrl->callBaseClass();
$ilBench->save();
Expand Down

0 comments on commit 931e3c3

Please sign in to comment.