Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Do not redirect to protected pages after logout (see #6210)
Browse files Browse the repository at this point in the history
  • Loading branch information
leofeyer committed Sep 23, 2013
1 parent a2355b2 commit bf3b9b0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
3 changes: 3 additions & 0 deletions system/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Contao Open Source CMS Changelog
Version 3.1.3 (2013-XX-XX)
--------------------------

### Fixed
Do not redirect to protected pages after logout (see #6210).

### Fixed
Consider the additional arguments in `Frontend::jumpToOrReload()` (see #5734).

Expand Down
15 changes: 12 additions & 3 deletions system/modules/core/modules/ModuleLogout.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,25 @@ public function generate()
}

$this->import('FrontendUser', 'User');

$blnUseJumpTo = ($this->jumpTo > 0);
$strRedirect = \Environment::get('base');

// Redirect to last page visited
if ($this->redirectBack && !empty($_SESSION['LAST_PAGE_VISITED']))
{
$strRedirect = $_SESSION['LAST_PAGE_VISITED'];
$objLastPage = \PageModel::findByIdOrAlias($this->getPageIdFromUrl($_SESSION['LAST_PAGE_VISITED']));

// Check whether the page is protected (see #6210)
if ($objLastPage !== null && !$objLastPage->protected)
{
$blnUseJumpTo = false;
$strRedirect = $_SESSION['LAST_PAGE_VISITED'];
}
}

// Redirect to jumpTo page
elseif ($this->jumpTo && ($objTarget = $this->objModel->getRelated('jumpTo')) !== null)
// Redirect to the jumpTo page
if ($blnUseJumpTo && ($objTarget = $this->objModel->getRelated('jumpTo')) !== null)
{
$strRedirect = $this->generateFrontendUrl($objTarget->row());
}
Expand Down

0 comments on commit bf3b9b0

Please sign in to comment.