Skip to content

Commit

Permalink
Updated BaseController->actionLogout(...) to always redirect to login…
Browse files Browse the repository at this point in the history
…-status when $show_status_on_completion is truthy
  • Loading branch information
rotimi committed Mar 14, 2024
1 parent 880e936 commit 06588b6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/controllers/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ public function actionLogout($show_status_on_completion = false): ResponseInterf
);
}

if($redirect_path === '') {
if($redirect_path === '' || ((bool)$show_status_on_completion)) {

// SMVC_APP_AUTO_PREPEND_ACTION_TO_ACTION_METHOD_NAMES === true
// means that links generated in this action do not need to be prefixed
Expand Down
13 changes: 9 additions & 4 deletions tests/BaseControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1507,10 +1507,15 @@ public function testThat_actionLogout_WorksAsExpected() {
self::assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $actionResult4);
self::assertEquals(302, $actionResult4->getStatusCode());
self::assertTrue($actionResult4->hasHeader('Location'));
self::assertEquals(
$_SESSION[BaseController::SESSN_PARAM_LOGIN_REDIRECT],
$actionResult4->getHeaderLine('Location')
); // the uri that the returned response object contains has the redirect url stored in session

if(SMVC_APP_AUTO_PREPEND_ACTION_TO_ACTION_METHOD_NAMES) {

self::assertEquals("{$controller4->getAppBasePath()}/da-shizzle-for-rizzle-controller/login-status", $actionResult4->getHeaderLine('Location'));

} else {

self::assertEquals("{$controller4->getAppBasePath()}/da-shizzle-for-rizzle-controller/action-login-status", $actionResult4->getHeaderLine('Location'));
}

////////////////////////////////////////////////////////////////////////

Expand Down

0 comments on commit 06588b6

Please sign in to comment.