Last active
January 21, 2026 11:24
-
-
Save fago/2b9f64e3102720f52dfe3980a8f3db96 to your computer and use it in GitHub Desktop.
fix-cache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/modules/lupus_decoupled_form/src/Controller/CustomElementsFormControllerTrait.php | |
| b/modules/lupus_decoupled_form/src/Controller/CustomElementsFormControllerTrait.php | |
| index 1234567..abcdefg 100644 | |
| --- a/modules/lupus_decoupled_form/src/Controller/CustomElementsFormControllerTrait.php | |
| +++ b/modules/lupus_decoupled_form/src/Controller/CustomElementsFormControllerTrait.php | |
| @@ -44,6 +44,10 @@ trait CustomElementsFormControllerTrait { | |
| foreach (['form_id', 'attributes', 'method'] as $key) { | |
| $element->setAttribute($key, $form['#' . $key] ?? NULL); | |
| } | |
| + // Do not cache forms for authenticated users to avoid cached CSRF tokens. | |
| + if (\Drupal::currentUser()->isAuthenticated()) { | |
| + $element->mergeCacheMaxAge(0); | |
| + } | |
| return $element; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment