Skip to content

Conversation

@robertcsakany
Copy link
Member

@robertcsakany robertcsakany commented Apr 25, 2024

BugJNG-5697 On modul switch token have to be revoked when it is related to different user

…te it

@robertcsakany robertcsakany requested a review from noherczeg April 25, 2024 12:08
@robertcsakany robertcsakany self-assigned this Apr 25, 2024
window.location.reload();
}
}
}, [useSearchParams, getUser]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useSearchParams is not used, should not be needed in the dependencies array.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getUser also never changes, so the dependency array should be empty I think.

clearSecurityStorage();
const { origin } = window.location;
window.location.href = origin + '/' + applicationKey;
window.location.href = origin + '/' + applicationKey + "?user=" + tokenUser ;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since tokenUser could be an email address, we might need to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent it to make sure special characters are encoded in the param. Not sure, we should check.

const tokenUser = profile?.preferred_username;
if (tokenUser != null && tokenUser === forcedUser) {
clearSecurityStorage();
window.location.reload();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ?user search param should be removed before we reload I think since we won't need it any more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants