diff --git a/app/assets/javascripts/miq_application.js b/app/assets/javascripts/miq_application.js index 27d4e4b8cdf..184a27b66f0 100644 --- a/app/assets/javascripts/miq_application.js +++ b/app/assets/javascripts/miq_application.js @@ -1718,6 +1718,10 @@ var fontIconChar = _.memoize(function(klass) { }); function redirectLogin(msg) { + if (ManageIQ.logoutInProgress) { + return; // prevent double redirect after pressing the Logout button + } + add_flash(msg, 'warning'); window.document.location.href = '/dashboard/login?timeout=true'; } diff --git a/app/assets/javascripts/miq_global.js b/app/assets/javascripts/miq_global.js index 66d73e859b0..28765478a12 100644 --- a/app/assets/javascripts/miq_global.js +++ b/app/assets/javascripts/miq_global.js @@ -48,6 +48,7 @@ if (!window.ManageIQ) { i18n: { mark_translated_strings: false, }, + logoutInProgress: false, // prevent redirectLogin *during* logout mouse: { x: null, // mouse X coordinate for popup menu y: null, // mouse Y coordinate for popup menu diff --git a/app/views/layouts/_user_options.html.haml b/app/views/layouts/_user_options.html.haml index 2e65161a4ba..a5275a3799f 100644 --- a/app/views/layouts/_user_options.html.haml +++ b/app/views/layouts/_user_options.html.haml @@ -46,7 +46,7 @@ = _(menu_item.name) %li.divider %li - %a{:href => "/dashboard/logout", :onclick => 'return miqCheckForChanges()', :title => _("Click to Logout")} + %a{:href => "/dashboard/logout", :onclick => 'ManageIQ.logoutInProgress = true; return miqCheckForChanges()', :title => _("Click to Logout")} = _('Logout') - else