Skip to content

Commit

Permalink
Prevent login redirect during change_group
Browse files Browse the repository at this point in the history
Once the group changes, ongoing requests start failing.
Prevent the login redirect code from redirecting to login page in these cases, the requests are expected to fail, we're about to redirect to a new starting page anyway.

Related to #6065
(and https://bugzilla.redhat.com/show_bug.cgi?id=1741283)

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1759291
  • Loading branch information
himdel committed Oct 22, 2019
1 parent 1aa7cb4 commit 36e1bae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion app/assets/javascripts/miq_application.js
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,10 @@ function miqShowAE_Tree(typ) {
// Toggle the user options div in the page header (:onclick from layouts/user_options)
function miqChangeGroup(id) {
miqSparkleOn();

// prevent login redirect once current requests fail after the group gets changed
ManageIQ.logoutInProgress = true;

miqJqueryRequest(miqPassFields('/dashboard/change_group', {to_group: id}));
}

Expand Down Expand Up @@ -1543,7 +1547,7 @@ var fontIconChar = _.memoize(function(klass) {

function redirectLogin(msg) {
if (ManageIQ.logoutInProgress) {
return; // prevent double redirect after pressing the Logout button
return; // prevent double redirect after pressing the Logout button or when changing group
}

add_flash(msg, 'warning');
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/miq_global.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ if (!window.ManageIQ) {
i18n: {
mark_translated_strings: false,
},
logoutInProgress: false, // prevent redirectLogin *during* logout
logoutInProgress: false, // prevent redirectLogin *during* logout and group change
mouse: {
x: null, // mouse X coordinate for popup menu
y: null, // mouse Y coordinate for popup menu
Expand Down

0 comments on commit 36e1bae

Please sign in to comment.