Skip to content

Conversation

@LZoog
Copy link
Contributor

@LZoog LZoog commented Oct 7, 2025

Because:

  • Users should not be able to directly bypass /signin_token_code

This commit:

  • Uses session.isSessionVerified to check if the user should be redirected away

closes FXA-12472


We can now use session.isSessionVerified for this as of my last PR.

You can test this with the SIGNIN_CONFIRMATION_TOKEN_VERIFICATION flag to get in an unverified state. Try to access settings directly after you're taken to /signin_token_code, and see you'll be redirected away from Settings.

@LZoog LZoog requested a review from a team as a code owner October 7, 2025 00:44
}

// If we're on settings route but user is not signed in, redirect immediately
if (window.location.pathname?.includes('/settings') && !isSignedIn) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We already have this same check for isSignedIn, under <SettingsRoutes />, so this seemed redundant. I'm not even sure if we need that isSignedIn check, but I'll look at that in the same follow up related to this stuff that I need to do.

I went ahead and removed hardNavigate here as well since we don't need it any longer.

@LZoog LZoog force-pushed the FXA-12472 branch 2 times, most recently from 6924d57 to e98f275 Compare October 7, 2025 15:49

async signout() {
const button = await this.element.waitForSelector(
const button = this.element.locator(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had to make these functional-test changes due to these waitForSelectors. There was a race condition where this was showing as "hidden", I guess due to the new isSessionVerified call. waitFor is the recommendation for Playwright but it won't work on multiple elements.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious what you mean by it "won't work on multiple elements". Is the selector here returning multiple elements?

PW should internally wait for visible as part of their "actionable" checks. I wonder if you'd be able to get away with removing the waitFor() all together?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm, possibly. My PR fails with waitForSelector due to it being "hidden", but I mistakenly used page.locator, before I realized we have a ConnectedServicesRow to check the page and that this was intended to be a single element. I reverted back to element.selector so I'll take a look at this again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ran a couple of tests locally that were previously failing and they passed, so pushed the update 🤞

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nshirley they passed! Woo. Thanks for reviewing.

Because:
* Users should not be able to directly bypass /signin_token_code

This commit:
* Uses session.isSessionVerified to check if the user should be redirected away

closes FXA-12472
@LZoog LZoog merged commit 0385afa into main Oct 8, 2025
19 checks passed
@LZoog LZoog deleted the FXA-12472 branch October 8, 2025 12:19
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