fix: on adding redirectUrl to the logout function, the url was not encoded (#40071)
This commit is contained in:
parent
3f8ce79e4b
commit
565387464c
|
|
@ -78,5 +78,30 @@ describe(
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
it("3. should logout user successfully using global logoutUser function and should redirect to the url provided with multiple query params", () => {
|
||||
let applicationUrl = "";
|
||||
EditorNavigation.SelectEntityByName("Page1", EntityType.Page);
|
||||
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget);
|
||||
propPane.EnterJSContext(
|
||||
"onClick",
|
||||
"{{logoutUser('/abc/def?test1=123&test2=456')}}",
|
||||
true,
|
||||
false,
|
||||
);
|
||||
cy.location().then((loc) => {
|
||||
propPane.ToggleJSMode("onClick", false);
|
||||
propPane.UpdatePropertyFieldValue("Label", "");
|
||||
propPane.TypeTextIntoField("Label", "LOGOUT GLOBAL");
|
||||
agHelper.ClickButton("LOGOUT GLOBAL");
|
||||
cy.location().should((loc) => {
|
||||
expect(loc.pathname).to.eq("/user/login");
|
||||
expect(loc.search).to.eq(
|
||||
"?redirectUrl=" +
|
||||
encodeURIComponent("/abc/def?test1=123&test2=456"),
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -728,7 +728,7 @@ export const setMessageConfig = (id: string, config: ProductAlertConfig) => {
|
|||
export function* globalFunctionLogoutUser(
|
||||
action: ReduxAction<{ redirectURL: string }>,
|
||||
) {
|
||||
const redirectURL = `${AUTH_LOGIN_URL}?redirectUrl=${action.payload?.redirectURL ? action.payload?.redirectURL : history.location.pathname}`;
|
||||
const redirectURL = `${AUTH_LOGIN_URL}?redirectUrl=${encodeURIComponent(action.payload?.redirectURL ? action.payload?.redirectURL : history.location.pathname)}`;
|
||||
|
||||
yield call(logoutSaga, {
|
||||
type: ReduxActionTypes.LOGOUT_USER_INIT,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user