Skip to content

Commit

Permalink
Enable reactfied lost password form on the core profiler connection p…
Browse files Browse the repository at this point in the history
…age (#95002)

* Enable react password lost form on the sign up page

* Remove currentyQuery props and use from value directly

* Use different track name

* Use legacy lost password link as a fallback
  • Loading branch information
moon0326 authored Oct 16, 2024
1 parent 07ee511 commit 8c7328d
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion client/blocks/signup-form/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import wooDnaConfig from 'calypso/jetpack-connect/woo-dna-config';
import { recordTracksEvent } from 'calypso/lib/analytics/tracks';
import formState from 'calypso/lib/form-state';
import { getLocaleSlug } from 'calypso/lib/i18n-utils';
import { isReactLostPasswordScreenEnabled } from 'calypso/lib/login';
import {
isCrowdsignalOAuth2Client,
isWooOAuth2Client,
Expand Down Expand Up @@ -607,6 +608,8 @@ class SignupForm extends Component {
if ( error_code === 'taken' ) {
const fieldValue = formState.getFieldValue( this.state.form, fieldName );
const link = addQueryArgs( { email_address: fieldValue }, this.getLoginLink() );
const lostPasswordLink = lostPassword( this.props.locale );

return (
<span key={ error_code }>
<p>
Expand All @@ -622,7 +625,28 @@ class SignupForm extends Component {
onClick={ ( event ) => this.handleLoginClick( event, fieldValue ) }
/>
),
pwdResetLink: <a href={ lostPassword( this.props.locale ) } />,
pwdResetLink: isReactLostPasswordScreenEnabled() ? (
<a
href={ lostPasswordLink }
onClick={ ( event ) => {
event.preventDefault();
recordTracksEvent( 'calypso_signup_reset_password_link_click' );
page(
login( {
redirectTo: this.props.redirectToAfterLoginUrl,
locale: this.props.locale,
action: this.props.isWooCoreProfilerFlow
? 'jetpack/lostpassword'
: 'lostpassword',
oauth2ClientId: this.props.oauth2Client && this.props.oauth2Client.id,
from: this.props.from,
} )
);
} }
/>
) : (
<a href={ lostPasswordLink } />
),
},
}
) }
Expand Down

0 comments on commit 8c7328d

Please sign in to comment.