[BUGFIX] Openid link is always shown 68/34368/2
authorFrank Nägler <typo3@naegler.net>
Wed, 19 Nov 2014 21:14:30 +0000 (22:14 +0100)
committerMarkus Klein <klein.t3@reelworx.at>
Wed, 19 Nov 2014 21:28:41 +0000 (22:28 +0100)
Show openid field and link only if EXT:openid is installed.
Additional an error in Login.js is fixed.

Resolves: #63072
Releases: master
Change-Id: I2055ae1b73387992af73f66d315ab52be9a633db
Reviewed-on: http://review.typo3.org/34368
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/sysext/backend/Classes/Controller/LoginController.php
typo3/sysext/backend/Resources/Private/Templates/login.html
typo3/sysext/backend/Resources/Public/JavaScript/Login.js

index 8f31afd..f1b8a0f 100644 (file)
@@ -18,6 +18,7 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Backend\Utility\IconUtility;
 use TYPO3\CMS\Core\Html\HtmlParser;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\HttpUtility;
 
@@ -240,6 +241,7 @@ class LoginController {
                                ';
                        $loginForm = $this->makeLogoutForm();
                }
+
                // Starting page:
                $this->content .= $GLOBALS['TBE_TEMPLATE']->startPage('TYPO3 CMS Login: ' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'], FALSE);
                // Add login form:
@@ -371,7 +373,13 @@ class LoginController {
                        'SITENAME' => htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'])
                );
                $markers = $this->emitRenderLoginFormSignal($markers);
-               return HtmlParser::substituteMarkerArray($mainContent, $markers, '###|###');
+               $mainContent = HtmlParser::substituteMarkerArray($mainContent, $markers, '###|###');
+
+               // OPENID_LOADED
+               if (!ExtensionManagementUtility::isLoaded('openid')) {
+                       $mainContent = HtmlParser::substituteSubpart($mainContent, 'OPENID_LOADED', '');
+               }
+               return $mainContent;
        }
 
        /**
index edb3338..698fd62 100644 (file)
 
                <div class="t3-login-footer">
                        <div id="t3-login-form-footer-default">
+                <!-- ###OPENID_LOADED### begin -->
                                <a id="t3-login-switchToOpenId" class="switchToOpenId text-muted">
                                        <i class="fa fa-openid"></i>###LABEL_SWITCHOPENID###
                                </a>
+                <!-- ###OPENID_LOADED### end -->
                        </div>
-
+            <!-- ###OPENID_LOADED### begin -->
                        <div id="t3-login-form-footer-openId" style="display: none;">
                                <a id="t3-login-switchToDefault" class="switchToOpenId">
                                        <i class="fa fa-key"></i>###LABEL_SWITCHDEFAULT###
                                </a>
                        </div>
+            <!-- ###OPENID_LOADED### end -->
                </div>
        </div>
        ###NEWS###
@@ -69,6 +72,7 @@
                </div>
        </div>
 
+<!-- ###OPENID_LOADED### begin -->
        <div class="form-group" id="t3-login-openid_url-section" style="display: none;">
                <div class="input-group">
                        <input type="text" id="openid_url" name="openid_url" value="###VALUE_OPENID_URL###" placeholder="###LABEL_OPENID###" class="form-control t3-openidurl" />
@@ -78,6 +82,7 @@
                        </div>
                </div>
        </div>
+<!-- ###OPENID_LOADED### end -->
 
        <div class="form-group">
                <!-- ###INTERFACE_SELECTOR### begin -->
index c2e76e3..57cf0c1 100755 (executable)
@@ -65,7 +65,7 @@ define('TYPO3/CMS/Backend/Login', ['jquery'], function($) {
                        $(options.usernameField).val('openid_url');
                }
 
-               setLogintypeCookie('openid');
+               BackendLogin.setLogintypeCookie('openid');
        };
 
        /**
@@ -86,7 +86,7 @@ define('TYPO3/CMS/Backend/Login', ['jquery'], function($) {
 
                $(options.usernameField).trigger('focus');
 
-               setLogintypeCookie('username');
+               BackendLogin.setLogintypeCookie('username');
        };
 
        /**
@@ -278,4 +278,4 @@ define('TYPO3/CMS/Backend/Login', ['jquery'], function($) {
                TYPO3.BackendLogin = BackendLogin;
                return BackendLogin;
        }();
-});
\ No newline at end of file
+});