Skip to content

Conversation

@tgolen
Copy link
Contributor

@tgolen tgolen commented Aug 15, 2020

Fixes #177

Test

Difficult to test, so we'll just see how it works on production.

@tgolen tgolen requested a review from AndrewGable August 15, 2020 15:07
@tgolen tgolen self-assigned this Aug 15, 2020
@tgolen tgolen requested review from Jag96 and removed request for AndrewGable August 15, 2020 15:58
Copy link
Contributor

@Jag96 Jag96 left a comment

Choose a reason for hiding this comment

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

I'm seeing some weird behavior if I'm signed out and I try to navigate to a report. If I'm signed out and I go to http://localhost:8080/#/22, I see the URL bar jumps around a bit and ends up with multiple signIn strings in the URL

const urlWithExitTo = url && url !== '/'
// The /exitTo... part is only added to the URL if the url is NOT the root of the site and it DOESN'T
// already have "exitTo" in it.
const urlWithExitTo = url && url !== '/' && url.indexOf('exitTo') === -1
Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, I think this is what we want here:

if (!url) {
    return;
}

// If we already have exitTo, don't redirect
if (url.indexOf('exitTo') !== -1 || url.indexOf('signin') !== -1) {
    return;
}

// If we're at the root, go to sign-in, otherwise add the exitTo
const urlWithExitTo = url !== '/'
    ? `${ROUTES.SIGNIN}/exitTo${url}`
    : ROUTES.SIGNIN;
return Ion.set(IONKEYS.APP_REDIRECT_TO, urlWithExitTo);

I tested this with the following 3 cases:

  1. Sign out of the app and go to http://localhost:8080/#/22, confirm you are taken to http://localhost:8080/#/signin/exitTo/22
  2. While signed out, navigate to http://localhost:8080/, confirm you are taken to http://localhost:8080/#/signin
  3. While signed out, navigate to http://localhost:8080/#/signin/exitTo/22, confirm the URL doesn't change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like that works well! Thanks. Committing it now

@tgolen
Copy link
Contributor Author

tgolen commented Aug 15, 2020

Updated. I tested this by adding a timeout on the homepage (in componentDidMount) like this:

        setTimeout(() => {
            redirectToSignIn();
        }, 5000);

Then logged in, went straight to a report. It redirected me to signIn, I signed in, then was back on the same report.

@Jag96 Jag96 merged commit 7f1cb87 into master Aug 15, 2020
@Jag96 Jag96 deleted the tgolen-fix-exitto branch August 15, 2020 19:20
mountiny pushed a commit that referenced this pull request Feb 12, 2025
…view-5

Fix issue: Workflows - RHP opens not here page when returning from Approver page
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.

Fresh login exitTo bug makes it very very hard to login

3 participants