From b129137771d646a17843092d5ca0bc953881c45a Mon Sep 17 00:00:00 2001 From: Ilyas Foo Date: Wed, 16 Oct 2024 10:56:23 +0800 Subject: [PATCH] Add redirect to /log-in page when user is already logged in for WCCOM login flow (#95353) * Add redirect to /log-in page when user is already logged in * Ensure return empty component --- client/signup/steps/user/index.jsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/signup/steps/user/index.jsx b/client/signup/steps/user/index.jsx index a46e62047a0ef..0b106a2b844f1 100644 --- a/client/signup/steps/user/index.jsx +++ b/client/signup/steps/user/index.jsx @@ -1,4 +1,5 @@ import config from '@automattic/calypso-config'; +import page from '@automattic/calypso-router'; import { localizeUrl } from '@automattic/i18n-utils'; import { isHostingSignupFlow, isNewsletterFlow } from '@automattic/onboarding'; import { WPCC } from '@automattic/urls'; @@ -747,6 +748,11 @@ export class UserStep extends Component { return this.renderGravatarSignupStep(); } + if ( isWooOAuth2Client( this.props.oauth2Client ) && this.props.userLoggedIn ) { + page( this.getLoginUrl() ); + return null; + } + // TODO: decouple hideBack flag from the flow name. return (