Skip to content

Commit

Permalink
Fix Login block not working
Browse files Browse the repository at this point in the history
| 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.
  • Loading branch information
craigh committed Jan 9, 2016
1 parent ab3090e commit e5bed21
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-1.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -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').
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
26 changes: 16 additions & 10 deletions src/system/SettingsModule/Resources/views/Admin/modifyconfig.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,27 @@
</div>
</div>
</div>
</fieldset>
<fieldset>
<legend>{gt text='Front Controller settings'}</legend>
<div class="form-group">
<label class="col-sm-3 control-label" for="settings_entrypoint">{gt text='Site entry point'}</label>
<label class="col-sm-3 control-label" for="settings_entrypoint">{gt text='Site entry point (front controller)'}</label>
<div class="col-sm-9">
<input id="settings_entrypoint" type="text" class="form-control" name="settings[entrypoint]" value="{$modvars.ZConfig.entrypoint|safetext}" size="20" maxlength="60" />
<em class="help-block">{gt text='(Default: index.php)'}</em>
<p class="help-block alert alert-info">{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."}</p>
<p class="help-block alert alert-danger">{gt text="Warning: This feature is deprecated and it is not recommended to change from index.php."}</p>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">{gt text='Strip entry point (front controller) from URLs'}</label>
<div id="settings_shorturlsstripentrypoint" class="col-sm-9">
<input id="shorturlsstripentrypoint1" type="radio" name="settings[shorturlsstripentrypoint]" value="1"{if $modvars.ZConfig.shorturlsstripentrypoint eq 1} checked="checked"{/if} />
<label for="shorturlsstripentrypoint1">{gt text='Yes (recommended)'}</label>
<input id="shorturlsstripentrypoint0" type="radio" name="settings[shorturlsstripentrypoint]" value="0"{if $modvars.ZConfig.shorturlsstripentrypoint eq 0} checked="checked"{/if} />
<label for="shorturlsstripentrypoint0">{gt text='No'}</label>
<em class="help-block alert alert-warning">{gt text="This setting was part of the 'shorturl configuration in the past (below)."}<br />
{gt text="It is now moved here because it is also used with core-1.4.x routing. This feature is deprecated."}</em>
</div>
</div>
</fieldset>
Expand Down Expand Up @@ -279,15 +294,6 @@
</div>
</div>
<div data-switch="settings[shorturls]" data-switch-value="1">
<div class="form-group">
<label class="col-sm-3 control-label">{gt text='Strip entry point from directory-based URLs'}</label>
<div id="settings_shorturlsstripentrypoint" class="col-sm-9">
<input id="shorturlsstripentrypoint1" type="radio" name="settings[shorturlsstripentrypoint]" value="1"{if $modvars.ZConfig.shorturlsstripentrypoint eq 1} checked="checked"{/if} />
<label for="shorturlsstripentrypoint1">{gt text='Yes (recommended)'}</label>
<input id="shorturlsstripentrypoint0" type="radio" name="settings[shorturlsstripentrypoint]" value="0"{if $modvars.ZConfig.shorturlsstripentrypoint eq 0} checked="checked"{/if} />
<label for="shorturlsstripentrypoint0">{gt text='No'}</label>
</div>
</div>
<div id="settings_shorturlsseparator_container" class="form-group">
<label class="col-sm-3 control-label" for="settings_shorturlsseparator">{gt text='Separator for permalink titles'}</label>
<div class="col-sm-9">
Expand Down
4 changes: 3 additions & 1 deletion src/system/UsersModule/Resources/views/Block/login.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
{ajaxheader modname=$authentication_method.modname filename=$authentication_method.modname|cat:'.LoginBlock.js'}
{/if}
{/foreach}
{/strip}<div class="users_loginblock_box">{strip}
{/strip}
<div class="users_loginblock_box">
{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'}
Expand Down

0 comments on commit e5bed21

Please sign in to comment.