Skip to content

Commit

Permalink
Merge pull request #170 from liayn/redirect-logged-in-user
Browse files Browse the repository at this point in the history
[BUGFIX] LoginController should redirect a logged-in user
  • Loading branch information
liayn authored Sep 26, 2024
2 parents cc897ba + 2c7cbe7 commit 84770bf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Classes/Controller/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
namespace Causal\Oidc\Controller;

use Causal\Oidc\Service\OpenIdConnectService;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Http\PropagateResponseException;
use TYPO3\CMS\Core\Http\RedirectResponse;
use TYPO3\CMS\Core\Http\ServerRequest;
Expand Down Expand Up @@ -66,8 +67,9 @@ public function login(string $_, ?array $pluginConfiguration)
$this->pluginConfiguration = $pluginConfiguration;
}

$context = GeneralUtility::makeInstance(Context::class);
$loginType = $this->request->getParsedBody()['logintype'] ?? $this->request->getQueryParams()['logintype'] ?? '';
if ($loginType === 'login') {
if ($loginType === 'login' || $context->getAspect('frontend.user')->isLoggedIn()) {
$redirectUrl = $this->determineRedirectUrl();
$this->redirect($redirectUrl);
}
Expand Down

0 comments on commit 84770bf

Please sign in to comment.