From e5bed219acce525ef2ed6577b09c259fa72aded3 Mon Sep 17 00:00:00 2001 From: Craig Heydenburg Date: Sat, 9 Jan 2016 14:34:51 -0500 Subject: [PATCH] Fix Login block not working | Q | A | ----------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | n/a | Fixed tickets | #2729 | Refs tickets | - | License | MIT | Doc PR | - | Changelog updated | yes fixes #2729 This also updates the 'strip front controller' settings in General Settings to move it to an area separate from shorturls since it is now being used independently of that feature. --- CHANGELOG-1.4.md | 1 + .../StripFrontControllerListener.php | 9 +++++-- .../Resources/views/Admin/modifyconfig.tpl | 26 ++++++++++++------- .../Resources/views/Block/login.tpl | 4 ++- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/CHANGELOG-1.4.md b/CHANGELOG-1.4.md index fc349bc53c..a0d49bcc97 100644 --- a/CHANGELOG-1.4.md +++ b/CHANGELOG-1.4.md @@ -16,6 +16,7 @@ CHANGELOG - ZIKULA 1.4.x - Fix error in BootstrapTheme where `pagetype` variable was required (#2681) - Fix legacy modules always using 'home' realm in Theme engine (#2691) - Correct minor display issues for new Symfony 2.8-style developer toolbar. + - Fix Login block not functional (#2729) - Features: - New advanced block filtering based on a combination of any query parameter or request attributes. - Added core routing for all legacy urls (both normal and 'shorturls'). diff --git a/src/lib/Zikula/Bundle/CoreBundle/EventListener/StripFrontControllerListener.php b/src/lib/Zikula/Bundle/CoreBundle/EventListener/StripFrontControllerListener.php index 66c0d23b3b..ed719828b3 100644 --- a/src/lib/Zikula/Bundle/CoreBundle/EventListener/StripFrontControllerListener.php +++ b/src/lib/Zikula/Bundle/CoreBundle/EventListener/StripFrontControllerListener.php @@ -46,13 +46,18 @@ public function onKernelRequest(GetResponseEvent $event) if (\System::isInstalling()) { return; } + if (!$event->getRequest()->isMethod('GET')) { + // because this issue is purely 'cosmetic', only fix GET requests. + return; + } $requestUri = $event->getRequest()->getRequestUri(); $frontController = \System::getVar('entrypoint', 'index.php'); $stripEntryPoint = (bool) \System::getVar('shorturlsstripentrypoint', false); - $containsFrontController = (strpos($requestUri, "$frontController/") !== false); + $containsFrontController = (strpos($requestUri, "$frontController") !== false); if ($containsFrontController && $stripEntryPoint) { - $url = str_ireplace("$frontController/", "", $requestUri); + $replacedString = (strpos($requestUri, "$frontController/") !== false) ? "$frontController/" : $frontController; + $url = str_ireplace($replacedString, "", $requestUri); $response = new RedirectResponse($url, 301); $event->setResponse($response); $event->stopPropagation(); diff --git a/src/system/SettingsModule/Resources/views/Admin/modifyconfig.tpl b/src/system/SettingsModule/Resources/views/Admin/modifyconfig.tpl index 35e0776ea5..e799c76258 100644 --- a/src/system/SettingsModule/Resources/views/Admin/modifyconfig.tpl +++ b/src/system/SettingsModule/Resources/views/Admin/modifyconfig.tpl @@ -193,12 +193,27 @@ + +
+ {gt text='Front Controller settings'}
- +
{gt text='(Default: index.php)'}

{gt text="Notice: The entry point file must be present in the Zikula root directory before you set it here as your site's start page."}

+

{gt text="Warning: This feature is deprecated and it is not recommended to change from index.php."}

+
+
+
+ +
+ + + + + {gt text="This setting was part of the 'shorturl configuration in the past (below)."}
+ {gt text="It is now moved here because it is also used with core-1.4.x routing. This feature is deprecated."}
@@ -279,15 +294,6 @@
-
- -
- - - - -
-
diff --git a/src/system/UsersModule/Resources/views/Block/login.tpl b/src/system/UsersModule/Resources/views/Block/login.tpl index b13b1f1437..036a54d1aa 100644 --- a/src/system/UsersModule/Resources/views/Block/login.tpl +++ b/src/system/UsersModule/Resources/views/Block/login.tpl @@ -5,7 +5,9 @@ {ajaxheader modname=$authentication_method.modname filename=$authentication_method.modname|cat:'.LoginBlock.js'} {/if} {/foreach} -{/strip}
{strip} +{/strip} +
+ {strip} {assign var='show_login_form' value=false} {if (isset($selected_authentication_method) && $selected_authentication_method)} {login_form_fields form_type='loginblock' authentication_method=$selected_authentication_method assign='login_form_fields'}