@@ -84,6 +84,7 @@ const Signin = ({
8484
8585 const isOAuth = isOAuthIntegration ( integration ) ;
8686 const isOAuthNative = isOAuthNativeIntegration ( integration ) ;
87+ const isSync = integration . isSync ( ) ;
8788 const clientId = integration . getClientId ( ) ;
8889 const hasLinkedAccountAndNoPassword = hasLinkedAccount && ! hasPassword ;
8990
@@ -95,17 +96,22 @@ const Signin = ({
9596 const [ hasCachedAccount , setHasCachedAccount ] =
9697 useState < boolean > ( ! ! sessionToken ) ;
9798
98- // A password is needed if :
99- // * There is no session token in local storage and the user has a password , OR
99+ // A password is needed and password input rendered if the user has a password AND :
100+ // * There is no session token in local storage, OR
100101 // * The integration wants keys (e.g. Sync always wants keys, and non-sync browser
101102 // services like Smart Window also request keys if there's no cached sign-in
102103 // to prevent a redirect to FxA to turn Sync on), OR
103104 // * The integration is OAuth and wants login (prompt=login)
104105 // UNLESS the user has a cached account AND they are in an OAuth Native flow AND
105106 // the browser supports the "keys optional" capability for non-Sync browser signins.
106107 // These users will be redirected to FxA later to enter a password to turn Sync on.
108+ //
109+ // If the user has no password (e.g. third-party auth only), we show the cached
110+ // sign-in view instead. After session verification, Sync users will be redirected
111+ // to set a password via post_verify/third_party_auth/set_password.
107112 const isPasswordNeeded =
108- ( ( ! hasCachedAccount && hasPassword ) ||
113+ hasPassword &&
114+ ( ! hasCachedAccount ||
109115 integration . wantsKeys ( ) ||
110116 ( isOAuth && integration . wantsLogin ( ) ) ) &&
111117 ! ( hasCachedAccount && supportsKeysOptionalLogin ) ;
@@ -136,9 +142,7 @@ const Signin = ({
136142 // Show for all other cases.
137143 const hideThirdPartyAuth =
138144 hasCachedAccount ||
139- ( integration . isSync ( )
140- ? hasPassword
141- : isOAuthNative && ! supportsKeysOptionalLogin ) ;
145+ ( isSync ? hasPassword : isOAuthNative && ! supportsKeysOptionalLogin ) ;
142146
143147 useEffect ( ( ) => {
144148 if ( ! isPasswordNeeded ) {
@@ -181,8 +185,12 @@ const Signin = ({
181185 queryParams : location . search ,
182186 performNavigation : ! integration . isFirefoxMobileClient ( ) ,
183187 isServiceWithEmailVerification,
184- handleFxaLogin : true ,
185- handleFxaOAuthLogin : true ,
188+ // Sync users in the cached path are passwordless (third-party auth);
189+ // defer web channel messages until after password creation.
190+ handleFxaLogin : ! isSync ,
191+ handleFxaOAuthLogin : ! isSync ,
192+ // Redirect passwordless Sync users to set_password after session verification.
193+ isSignInWithThirdPartyAuth : isSync ,
186194 } ;
187195
188196 const { error : navError } = await handleNavigation ( navigationOptions ) ;
@@ -209,6 +217,7 @@ const Signin = ({
209217 setLocalizedBannerError ,
210218 integration ,
211219 finishOAuthFlowHandler ,
220+ isSync ,
212221 location . search ,
213222 webRedirectCheck ,
214223 isServiceWithEmailVerification ,
0 commit comments