Fixed bug #14640: Improve cookie detection at login screen (Thanks to Steffen Gebert)
authorSteffen Kamper <info@sk-typo3.de>
Sun, 13 Jun 2010 23:45:22 +0000 (23:45 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Sun, 13 Jun 2010 23:45:22 +0000 (23:45 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@7913 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/t3skin/resources/login.js
typo3/sysext/t3skin/stylesheets/structure/login_screen.css
typo3/sysext/t3skin/stylesheets/visual/login_screen.css
typo3/sysext/t3skin/templates/login.html

index 8769e90..f7c1075 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 2010-06-13  Steffen Kamper  <info@sk-typo3.de>
 
+       * Fixed bug #14640: Improve cookie detection at login screen (Thanks to Steffen Gebert)
        * Fixed bug #14565: There is no way to disable compress and concatenate
        * Fixed bug #14545: [No Title] shown when editing a record on root level (Thanks to Reinhard Fuehricht)
        * Fixed bug #14681: Use self:: for static method calls with classname:: within the same class in t3lib (Thanks to Sebastian Michaelsen)
index 7cd98c7..7302997 100644 (file)
@@ -10,6 +10,7 @@ TYPO3BackendLogin = {
                TYPO3BackendLogin.registerEventListeners();
                TYPO3BackendLogin.setVisibilityOfClearIcon($('t3-username'), $('t3-username-clearIcon'));
                TYPO3BackendLogin.setVisibilityOfClearIcon($('t3-password'), $('t3-password-clearIcon'));
+               TYPO3BackendLogin.checkCookieSupport();
                TYPO3BackendLogin.checkForLogintypeCookie();
                TYPO3BackendLogin.checkForInterfaceCookie();
                $('t3-username').activate();
@@ -157,7 +158,37 @@ TYPO3BackendLogin = {
                
                TYPO3BackendLogin.setLogintypeCookie('username');
        },
-       
+
+       /**
+        * Checks browser's cookie support
+        */
+       checkCookieSupport: function() {
+               Ext.util.Cookies.set('typo3-login-cookiecheck', true);
+               cookieEnabled = Ext.util.Cookies.get('typo3-login-cookiecheck');
+
+               if (!cookieEnabled) {
+                       TYPO3BackendLogin.showCookieWarning()
+               }
+
+               Ext.util.Cookies.clear('typo3-login-cookiecheck');
+       },
+
+       /**
+        * Hides input fields and shows cookie warning
+        */
+       showCookieWarning: function() {
+               Ext.get('t3-login-form-fields').setVisibilityMode(Ext.Element.DISPLAY).hide();
+               Ext.get('t3-nocookies-error').show();
+       },
+
+       /**
+        * Hides cookie warning and shows input fields
+        */
+       hideCookieWarning: function() {
+               Ext.get('t3-nocookies-error').setVisibilityMode(Ext.Element.DISPLAY).hide();
+               Ext.get('t3-login-form-fields').show();
+       },
+
        /**
         * Store a login type in a cookie to save it for future visits
         * Login type means wether you login by username/password or OpenID
@@ -218,4 +249,4 @@ TYPO3BackendLogin = {
        }
 };
 
-Event.observe(window, 'load', TYPO3BackendLogin.start);
+Ext.onReady(TYPO3BackendLogin.start, TYPO3BackendLogin);
index 34af2a5..5005334 100644 (file)
@@ -101,7 +101,6 @@ body#typo3-index-php .t3-login-field input {
 }
 
 body#typo3-index-php #t3-login-form-fields {
-       display: none;
        margin: 0;
        padding: 14px 0 5px 30px;
 }
@@ -140,6 +139,10 @@ body#typo3-index-php .t3-login-error {
        padding: 10px;
 }
 
+#t3-nocookies-ignore {
+       margin-top: 10px;
+}
+
 body#typo3-index-php div#t3-copyright-notice {
        margin-top: 15px;
 }
index bb2310f..58fc4f1 100644 (file)
@@ -195,6 +195,10 @@ body#typo3-index-php .t3-login-logout-form div.t3-login-label {
        color: #be0027;
 }
 
+#t3-nocookies-ignore {
+       text-align: center;
+}
+
 .t3-login-alert-warning {
        background: #fbf6de;
        border: 1px solid #b1905c;
index 9e5eff7..8f30534 100644 (file)
                                </noscript>
                                <div id="t3-nocookies-error" class="t3-login-alert t3-login-alert-warning" style="display:none">
                                        <h2>###ERROR_COOKIES###</h2>
+                                       <div id="t3-nocookies-ignore"><a href="#"  onclick="TYPO3BackendLogin.hideCookieWarning()">###ERROR_COOKIES_IGNORE###</a></div>
                                </div>
                                <div id="t3-login-process" style="display: none">
                                        <h2>###LOGIN_PROCESS###</h2>
                                </div>
                                ###FORM###
                                <div class="t3-login-bottomBorder"></div>
-                               <script type="text/javascript">
-                               /*<![CDATA[*/
-                                       document.cookie = "typo3-login-cookiecheck";
-                                       cookieEnabled = (document.cookie.indexOf("typo3-login-cookiecheck") != -1) ? true : false;
-                                       if (cookieEnabled) {
-                                               document.getElementById("t3-login-form-fields").style.display = 'block';
-                                       }
-                                       else {
-                                               document.getElementById("t3-nocookies-error").style.display = 'block';
-                                       }
-                               /*]]>*/
-                               </script>
                                <script type="text/javascript" src="sysext/t3skin/resources/login.js"></script>
                        </div>
                        <div class="shadow-box-bottom-424"></div>