fix: OIDC Redirect erases query parameters (#1773)
* fix: OIDC Redirect erases query parameters * prevent issues Co-authored-by: James Petts <jamesapetts@gmail.com>
This commit is contained in:
parent
ab25be3520
commit
6123741765
@ -52,10 +52,13 @@ class OHIFStandaloneViewer extends Component {
|
||||
const { appConfig = {} } = this.context;
|
||||
const userNotLoggedIn = userManager && (!user || user.expired);
|
||||
if (userNotLoggedIn) {
|
||||
const pathname = this.props.location.pathname;
|
||||
const { pathname, search } = this.props.location;
|
||||
|
||||
if (pathname !== '/callback') {
|
||||
sessionStorage.setItem('ohif-redirect-to', pathname);
|
||||
sessionStorage.setItem(
|
||||
'ohif-redirect-to',
|
||||
JSON.stringify({ pathname, search })
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
@ -103,12 +106,21 @@ class OHIFStandaloneViewer extends Component {
|
||||
|
||||
userManager.removeUser().then(() => {
|
||||
if (targetLinkUri !== null) {
|
||||
const ohifRedirectTo = {
|
||||
pathname: new URL(targetLinkUri).pathname,
|
||||
};
|
||||
sessionStorage.setItem(
|
||||
'ohif-redirect-to',
|
||||
new URL(targetLinkUri).pathname
|
||||
JSON.stringify(ohifRedirectTo)
|
||||
);
|
||||
} else {
|
||||
sessionStorage.setItem('ohif-redirect-to', '/');
|
||||
const ohifRedirectTo = {
|
||||
pathname: '/',
|
||||
};
|
||||
sessionStorage.setItem(
|
||||
'ohif-redirect-to',
|
||||
JSON.stringify(ohifRedirectTo)
|
||||
);
|
||||
}
|
||||
|
||||
if (loginHint !== null) {
|
||||
@ -191,10 +203,10 @@ class OHIFStandaloneViewer extends Component {
|
||||
{match === null ? (
|
||||
<></>
|
||||
) : (
|
||||
<ErrorBoundary context={match.url}>
|
||||
<Component match={match} location={this.props.location} />
|
||||
</ErrorBoundary>
|
||||
)}
|
||||
<ErrorBoundary context={match.url}>
|
||||
<Component match={match} location={this.props.location} />
|
||||
</ErrorBoundary>
|
||||
)}
|
||||
</CSSTransition>
|
||||
)}
|
||||
</Route>
|
||||
|
||||
@ -14,9 +14,11 @@ class CallbackPage extends Component {
|
||||
<CallbackComponent
|
||||
userManager={this.props.userManager}
|
||||
successCallback={() => {
|
||||
const pathname = sessionStorage.getItem('ohif-redirect-to');
|
||||
const { pathname, search = '' } = JSON.parse(
|
||||
sessionStorage.getItem('ohif-redirect-to')
|
||||
);
|
||||
|
||||
this.props.history.push(pathname);
|
||||
this.props.history.push({ pathname, search });
|
||||
}}
|
||||
errorCallback={error => {
|
||||
//this.props.history.push("/");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user