Skip to content

Commit 2c7cbe7

Browse files
committed
[BUGFIX] LoginController should redirect a logged-in user
If a user is already logged in do not restart the authentication process, but simply redirect as it would happen after a successful login. Resolves: #161
1 parent 65a9d86 commit 2c7cbe7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Classes/Controller/LoginController.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
namespace Causal\Oidc\Controller;
1919

2020
use Causal\Oidc\Service\OpenIdConnectService;
21+
use TYPO3\CMS\Core\Context\Context;
2122
use TYPO3\CMS\Core\Http\PropagateResponseException;
2223
use TYPO3\CMS\Core\Http\RedirectResponse;
2324
use TYPO3\CMS\Core\Http\ServerRequest;
@@ -66,8 +67,9 @@ public function login(string $_, ?array $pluginConfiguration)
6667
$this->pluginConfiguration = $pluginConfiguration;
6768
}
6869

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

0 commit comments

Comments
 (0)