Skip to content

Commit 3252b3a

Browse files
committed
Woo JPC: Do not use code token type when trying to magic login
1 parent f5a48d7 commit 3252b3a

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

client/blocks/login/index.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,10 @@ export default connect(
656656
redirectTo: stateProps.redirectTo,
657657
loginFormFlow: true,
658658
showGlobalNotices: false,
659-
...( shouldUseMagicCode( { isJetpack: ownProps.isJetpack } ) && { tokenType: 'code' } ),
659+
...( shouldUseMagicCode( {
660+
isWooJPC: stateProps.isWooJPC,
661+
isJetpack: ownProps.isJetpack,
662+
} ) && { tokenType: 'code' } ),
660663
source: stateProps.isWooJPC ? 'woo-passwordless-jpc' + '-' + get( stateProps, 'from' ) : '',
661664
flow:
662665
( ownProps.isJetpack && 'jetpack' ) ||

client/blocks/login/utils/should-use-magic-code.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,22 @@ type ShouldUseMagicCodeProps = {
55
* Whether the login is for a Jetpack site.
66
*/
77
isJetpack?: boolean;
8+
/**
9+
* Whether the login is for a Woo Jetpack Connection.
10+
*/
11+
isWooJPC?: boolean;
812
};
913

1014
/**
1115
* Returns true if the login should use magic code.
1216
* @param {ShouldUseMagicCodeProps} options
1317
* @returns {boolean}
1418
*/
15-
export function shouldUseMagicCode( { isJetpack }: ShouldUseMagicCodeProps ): boolean {
19+
export function shouldUseMagicCode( { isJetpack, isWooJPC }: ShouldUseMagicCodeProps ): boolean {
20+
if ( isWooJPC ) {
21+
return false;
22+
}
23+
1624
const isMagicCodeEnabled = config.isEnabled( 'login/use-magic-code' );
1725

1826
if ( isJetpack && isMagicCodeEnabled ) {

0 commit comments

Comments
 (0)