From 0520918ef92b51ac20e69d4f425eb4b1e305c16f Mon Sep 17 00:00:00 2001 From: Ingolf Steinhardt Date: Wed, 15 Nov 2023 20:57:33 +0100 Subject: [PATCH] Fix request token at change language --- .../AbstractListShowAllHandler.php | 2 +- .../contao/handler_backend_listeners.yml | 4 +- .../handler_multiple_backend_listeners.yml | 2 +- src/Resources/config/services.yml | 2 +- .../contao/templates/dcbe_general_edit.html5 | 156 +++++++++--------- 5 files changed, 79 insertions(+), 87 deletions(-) diff --git a/src/Contao/View/Contao2BackendView/ActionHandler/AbstractListShowAllHandler.php b/src/Contao/View/Contao2BackendView/ActionHandler/AbstractListShowAllHandler.php index 4ee49f1e9..e97cbc462 100644 --- a/src/Contao/View/Contao2BackendView/ActionHandler/AbstractListShowAllHandler.php +++ b/src/Contao/View/Contao2BackendView/ActionHandler/AbstractListShowAllHandler.php @@ -141,7 +141,7 @@ public function __construct( $this->ccaTranslator = $ccaTranslator; if (null === $tokenManager) { - $tokenManager = System::getContainer()->get('security.csrf.token_manager'); + $tokenManager = System::getContainer()->get('contao.csrf.token_manager'); assert($tokenManager instanceof CsrfTokenManagerInterface); // @codingStandardsIgnoreStart diff --git a/src/Resources/config/contao/handler_backend_listeners.yml b/src/Resources/config/contao/handler_backend_listeners.yml index 9cf8ff6f7..7d8120695 100644 --- a/src/Resources/config/contao/handler_backend_listeners.yml +++ b/src/Resources/config/contao/handler_backend_listeners.yml @@ -69,7 +69,7 @@ services: - "@cca.dc-general.scope-matcher" - "@translator" - "@cca.translator.contao_translator" - - "@security.csrf.token_manager" + - "@contao.csrf.token_manager" - "%contao.csrf_token_name%" tags: - name: kernel.event_listener @@ -83,7 +83,7 @@ services: - "@cca.dc-general.scope-matcher" - "@translator" - "@cca.translator.contao_translator" - - "@security.csrf.token_manager" + - "@contao.csrf.token_manager" - "%contao.csrf_token_name%" tags: - name: kernel.event_listener diff --git a/src/Resources/config/contao/handler_multiple_backend_listeners.yml b/src/Resources/config/contao/handler_multiple_backend_listeners.yml index ce6b8eb56..5c95a24d1 100644 --- a/src/Resources/config/contao/handler_multiple_backend_listeners.yml +++ b/src/Resources/config/contao/handler_multiple_backend_listeners.yml @@ -46,7 +46,7 @@ services: - "@cca.dc-general.scope-matcher" - "@translator" - "@cca.translator.contao_translator" - - "@security.csrf.token_manager" + - "@contao.csrf.token_manager" - "%contao.csrf_token_name%" tags: - name: kernel.event_listener diff --git a/src/Resources/config/services.yml b/src/Resources/config/services.yml index 557cda071..d63de116e 100644 --- a/src/Resources/config/services.yml +++ b/src/Resources/config/services.yml @@ -37,7 +37,7 @@ services: cca.dc-general.security-url-builder-factory: class: ContaoCommunityAlliance\UrlBuilder\Contao\CsrfUrlBuilderFactory arguments: - - '@security.csrf.token_manager' + - '@contao.csrf.token_manager' - '%contao.csrf_token_name%' ContaoCommunityAlliance\DcGeneral\Contao\Cache\Http\ContaoInvalidateCacheTags: diff --git a/src/Resources/contao/templates/dcbe_general_edit.html5 b/src/Resources/contao/templates/dcbe_general_edit.html5 index 5665d9403..06ee0cf6b 100644 --- a/src/Resources/contao/templates/dcbe_general_edit.html5 +++ b/src/Resources/contao/templates/dcbe_general_edit.html5 @@ -1,112 +1,104 @@ get('contao.csrf.token_manager')->getToken(\System::getContainer()->getParameter('contao.csrf_token_name')); + // Add CSS $GLOBALS['TL_CSS'][] = 'bundles/ccadcgeneral/css/generalDriver.css'; ?> versions): ?> -
-
-
- - - -
-
-
+
+
+
+ + + +
+
+
insert( 'dcbe_general_language_selector', [ - 'language' => $this->language, - 'languages' => $this->languages, - 'request' => $this->Environment->request, - 'submit' => $this->languageSubmit, - 'REQUEST_TOKEN' => REQUEST_TOKEN, - ]) ?> + 'language' => $this->language, + 'languages' => $this->languages, + 'request' => $this->Environment->request, + 'submit' => $this->languageSubmit, + 'REQUEST_TOKEN' => $requestToken, + ] +) ?> -getBackButton(); ?> +getBackButton() ?> breadcrumb)): ?> -
- breadcrumb; ?> -
- -

subHeadline; ?>languageHeadline != "")? " - " . $this->languageHeadline : ""; ?>

-getMessages(); ?> - -
onsubmit): ?> onsubmit="onsubmit; ?>"> -
- - -error): ?> - error)): ?> -
- - -

', $this->error); ?> -

- - - error)): ?> +
+ breadcrumb ?>
- +

subHeadline ?>languageHeadline != "") ? " - " . $this->languageHeadline : "" ?>

+getMessages() ?> -fieldsets as $arrFieldset): if($arrFieldset['legend'] ?? null): ?> -
- - -
- -
- -
- - -
+onsubmit): ?> onsubmit="onsubmit ?>"> +
+ + + error): ?> + error)): ?> +
+ -
+

', $this->error) ?>

+ -
- editButtons ?> -
+ error)): ?> +
+ + -
+ fieldsets as $arrFieldset): + if($arrFieldset['legend'] ?? null): ?> +
+ + +
+ +
+ +
+ +
+
+
+ editButtons ?> +
+
- noReload): ?> - -