0011478: registry cleanup fails if redirect after logout is configured
authorPhilipp Schüle <p.schuele@metaways.de>
Wed, 9 Dec 2015 14:38:32 +0000 (15:38 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 10 Dec 2015 09:27:27 +0000 (10:27 +0100)
* clears registry before redirect

https://forge.tine20.org/view.php?id=11478

Change-Id: Id0b5a3f54c875224509596e6907ceb589ec1c12c
Reviewed-on: http://gerrit.tine20.com/customers/2487
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/js/MainMenu.js
tine20/Tinebase/js/common.js

index a6ff8fc..6b3ffa2 100644 (file)
@@ -286,12 +286,12 @@ Tine.Tinebase.MainMenu = Ext.extend(Ext.Toolbar, {
                     document.execCommand('ClearAuthenticationCache');
                 }
 
-                // remove the event handler
                 // the reload() triggers the unload event
-                // TODO move redirect handling to Tine.Tinebase.common.reload
                 var redirect = (Tine.Tinebase.registry.get('redirectUrl'));
                 if (redirect && redirect != '') {
-                    window.location = Tine.Tinebase.registry.get('redirectUrl');
+                    Tine.Tinebase.common.reload({
+                        redirectUrl: Tine.Tinebase.registry.get('redirectUrl')
+                    });
                 } else {
                     // registry is cleared before reload
                     Tine.Tinebase.common.reload({});
index 7594f95..33f03c8 100644 (file)
@@ -128,7 +128,7 @@ Tine.Tinebase.common = {
      * @param {Object} options
      *      {Boolean} keepRegistry
      *      {Boolean} clearCache
-     *      {String}  url
+     *      {String}  redirectUrl
      */
     reload: function(options) {
         options = options || {};
@@ -138,8 +138,12 @@ Tine.Tinebase.common = {
             Tine.Tinebase.tineInit.clearRegistry();
         }
 
-        window.setTimeout(function(){
-            window.location.reload(!! options.clearCache);
+        window.setTimeout(function () {
+            if (options.redirectUrl && Ext.isString(options.redirectUrl)) {
+                window.location = options.redirectUrl;
+            } else {
+                window.location.reload(!!options.clearCache);
+            }
         }, 500);
     },