Skip to content

Commit

Permalink
Gravatar: Disable the email input for Gravatar-powered clients (#94172)
Browse files Browse the repository at this point in the history
  • Loading branch information
wellyshen authored Sep 4, 2024
1 parent 754afee commit 34d3314
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions client/blocks/login/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,26 @@ class Login extends Component {
this.props.requestError?.field === 'usernameOrEmail' &&
this.props.requestError?.code === 'email_login_not_allowed'
) {
const magicLoginUrl = login( {
let urlConfig = {
locale: this.props.locale,
twoFactorAuthType: 'link',
oauth2ClientId: this.props.currentQuery?.client_id,
redirectTo: this.props.redirectTo,
usernameOnly: true,
} );
};

if ( this.props.isGravPoweredClient ) {
urlConfig = {
...urlConfig,
gravatarFrom:
isGravatarOAuth2Client( this.props.oauth2Client ) &&
this.props.currentQuery?.gravatar_from,
gravatarFlow: isGravatarFlowOAuth2Client( this.props.oauth2Client ),
emailAddress: this.props.currentQuery?.email_address,
};
}

const magicLoginUrl = login( urlConfig );

page( magicLoginUrl );
}
Expand Down

0 comments on commit 34d3314

Please sign in to comment.