From ccc6716bf50d099e398b9e805d1212a57c2012c5 Mon Sep 17 00:00:00 2001 From: Fabian Martin Date: Mon, 2 Aug 2021 13:55:44 +0200 Subject: [PATCH 1/3] [TASK] Add possibility to add an anchor to the referrer url --- Classes/Controller/LoginController.php | 11 +++++++++-- Configuration/FlexForms/LoginForm.xml | 10 ++++++++++ Resources/Private/Language/Database.xlf | 3 +++ Resources/Private/Language/de.Database.xlf | 3 +++ 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Classes/Controller/LoginController.php b/Classes/Controller/LoginController.php index ceedea1e..25ad899a 100644 --- a/Classes/Controller/LoginController.php +++ b/Classes/Controller/LoginController.php @@ -152,7 +152,8 @@ public function loginAction(?string $rawAdditionalAuthorizeParameters = null): v } $this->logger->notice('Try to login user.'); - $this->getAuth0()->login(null, null, $additionalAuthorizeParameters); + $auth0 = $this->getAuth0(); + $auth0->login(null, null, $additionalAuthorizeParameters); } $this->redirect('form'); @@ -211,13 +212,15 @@ protected function getAuth0(): Auth0 if ($this->auth0 instanceof Auth0) { return $this->auth0; } - if ($this->extensionConfiguration->isGenericCallback()) { $callback = $this->getCallback('login'); } else { trigger_error('Using callback settings for frontend request is deprecated as there is a dedicated callback middleware.', E_USER_DEPRECATED); $uri = $GLOBALS['TYPO3_REQUEST']->getUri(); $referrer = sprintf('%s://%s%s', $uri->getScheme(), $uri->getHost(), $uri->getPath()); + if ($this->settings['referrerAnchor']) { + $referrer .= '#' . $this->settings['referrerAnchor']; + } $routingUtility = GeneralUtility::makeInstance(RoutingUtility::class); $callbackSettings = $this->settings['frontend']['callback'] ?? []; @@ -235,7 +238,11 @@ protected function getAuth0(): Auth0 protected function getCallback(string $loginType = 'login'): string { $uri = $GLOBALS['TYPO3_REQUEST']->getUri(); + $referrer = $GLOBALS['TYPO3_REQUEST']->getQueryParams()['referrer'] ?? sprintf('%s://%s%s', $uri->getScheme(), $uri->getHost(), $uri->getPath()); + if ($this->settings['referrerAnchor']) { + $referrer .= '#' . $this->settings['referrerAnchor']; + } $tokenUtility = GeneralUtility::makeInstance(TokenUtility::class); $tokenUtility->withPayload('application', $this->application); diff --git a/Configuration/FlexForms/LoginForm.xml b/Configuration/FlexForms/LoginForm.xml index 1e49febf..a17665b6 100644 --- a/Configuration/FlexForms/LoginForm.xml +++ b/Configuration/FlexForms/LoginForm.xml @@ -50,6 +50,16 @@ + + + + + input + 30 + trim + + + diff --git a/Resources/Private/Language/Database.xlf b/Resources/Private/Language/Database.xlf index 8f8a0b33..a592fe60 100644 --- a/Resources/Private/Language/Database.xlf +++ b/Resources/Private/Language/Database.xlf @@ -86,6 +86,9 @@ + + Anchor for the referrer/callback url + Redirects diff --git a/Resources/Private/Language/de.Database.xlf b/Resources/Private/Language/de.Database.xlf index 50926e45..85de4ce7 100644 --- a/Resources/Private/Language/de.Database.xlf +++ b/Resources/Private/Language/de.Database.xlf @@ -86,6 +86,9 @@ + + Anchor for the referrer/callback url + Weiterleitungen From 9a1f4aeab9b92424ddb90a63fe9787957c087a08 Mon Sep 17 00:00:00 2001 From: Fabian Martin Date: Mon, 2 Aug 2021 13:59:59 +0200 Subject: [PATCH 2/3] [TASK] Refactor code --- Classes/Controller/LoginController.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Classes/Controller/LoginController.php b/Classes/Controller/LoginController.php index 25ad899a..43bca88b 100644 --- a/Classes/Controller/LoginController.php +++ b/Classes/Controller/LoginController.php @@ -152,8 +152,7 @@ public function loginAction(?string $rawAdditionalAuthorizeParameters = null): v } $this->logger->notice('Try to login user.'); - $auth0 = $this->getAuth0(); - $auth0->login(null, null, $additionalAuthorizeParameters); + $this->getAuth0()->login(null, null, $additionalAuthorizeParameters); } $this->redirect('form'); From 53c86a0d86ff03e6114e601a8e9833c17b7ab004 Mon Sep 17 00:00:00 2001 From: Fabian Martin Date: Tue, 3 Aug 2021 09:22:48 +0200 Subject: [PATCH 3/3] [TASK] Add german translation --- Resources/Private/Language/de.Database.xlf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/Private/Language/de.Database.xlf b/Resources/Private/Language/de.Database.xlf index 85de4ce7..225d03d7 100644 --- a/Resources/Private/Language/de.Database.xlf +++ b/Resources/Private/Language/de.Database.xlf @@ -87,7 +87,7 @@ - Anchor for the referrer/callback url + Anker für die Referrer/Callback url Weiterleitungen