Skip to content

Commit 7c0bbe2

Browse files
author
rotimi
committed
Under the hood tweak
1 parent f646bab commit 7c0bbe2

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

src/controllers/BaseController.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -751,9 +751,7 @@ public function actionLogin(): ResponseInterface|string {
751751

752752
//re-direct
753753
/** @psalm-suppress MixedArgument */
754-
return $this->response
755-
->withStatus(302)
756-
->withHeader('Location', $success_redirect_path);
754+
return $this->redirect($success_redirect_path, false, 302);
757755
} else {
758756

759757
//re-display login form with error messages
@@ -1006,7 +1004,7 @@ public function actionLogout(mixed $show_status_on_completion = false): Response
10061004

10071005
//re-direct
10081006
/** @psalm-suppress MixedArgument */
1009-
return $this->response->withStatus(302)->withHeader('Location', $redirect_path);
1007+
return $this->redirect($redirect_path, false, 302);
10101008
}
10111009

10121010
/**
@@ -1087,7 +1085,7 @@ public function getResponseObjForLoginRedirectionIfNotLoggedIn(): bool|\Psr\Http
10871085
$action = (SMVC_APP_AUTO_PREPEND_ACTION_TO_ACTION_METHOD_NAMES) ? 'login' : 'action-login';
10881086
$redr_path = $this->makeLink("/{$controller}/$action");
10891087

1090-
return $this->response->withStatus(302)->withHeader('Location', $redr_path);
1088+
return $this->redirect($redr_path, false, 302);
10911089
}
10921090

10931091
return false;
@@ -1549,7 +1547,7 @@ public function logWarning(string $logMessage): static {
15491547
*
15501548
* @psalm-suppress PossiblyUnusedMethod
15511549
*/
1552-
public function redirect(string $url, bool $callMakeLink=true, int $status = 301): ResponseInterface {
1550+
public function redirect(string $url, bool $callMakeLink=true, int $status = 302): ResponseInterface {
15531551

15541552
return $this->response
15551553
->withStatus($status)

0 commit comments

Comments
 (0)