diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fca9db40..4dce6e0de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.48.0] - 2024-10-07 +### Fixes + +- Fixed an issue where the `AuthPage` was using full-page redirects to navigate to the password reset page if both emailpassword and passwordless were enabled. + ### Changes - Added the `OAuth2Provider` recipe diff --git a/lib/build/passwordlessprebuiltui.js b/lib/build/passwordlessprebuiltui.js index 1d2c93364..cc39350dc 100644 --- a/lib/build/passwordlessprebuiltui.js +++ b/lib/build/passwordlessprebuiltui.js @@ -5603,11 +5603,14 @@ var EPComboEmailForm = uiEntry.withOverride( genericComponentOverrideContext.__assign( { onClick: function () { - return recipe$1.EmailPassword.getInstanceOrThrow().redirect({ - action: "RESET_PASSWORD", - tenantIdFromQueryParams: - genericComponentOverrideContext.getTenantIdFromQueryParams(), - }); + return recipe$1.EmailPassword.getInstanceOrThrow().redirect( + { + action: "RESET_PASSWORD", + tenantIdFromQueryParams: + genericComponentOverrideContext.getTenantIdFromQueryParams(), + }, + props.navigate + ); }, "data-supertokens": "link linkButton formLabelLinkBtn forgotPasswordLink", }, @@ -5786,11 +5789,14 @@ var EPComboEmailOrPhoneForm = uiEntry.withOverride( genericComponentOverrideContext.__assign( { onClick: function () { - return recipe$1.EmailPassword.getInstanceOrThrow().redirect({ - action: "RESET_PASSWORD", - tenantIdFromQueryParams: - genericComponentOverrideContext.getTenantIdFromQueryParams(), - }); + return recipe$1.EmailPassword.getInstanceOrThrow().redirect( + { + action: "RESET_PASSWORD", + tenantIdFromQueryParams: + genericComponentOverrideContext.getTenantIdFromQueryParams(), + }, + props.navigate + ); }, "data-supertokens": "link linkButton formLabelLinkBtn forgotPasswordLink", }, @@ -6257,6 +6263,7 @@ function useChildProps$1( (_a = recipe$2.config.validatePhoneNumber) !== null && _a !== void 0 ? _a : defaultPhoneNumberValidator, + navigate: navigate, }; }, [ @@ -6267,6 +6274,7 @@ function useChildProps$1( isPhoneNumber, showPasswordField, showContinueWithPasswordlessLink, + navigate, ] ); } diff --git a/lib/build/recipe/passwordless/types.d.ts b/lib/build/recipe/passwordless/types.d.ts index 28a0bc2ac..d82f7d330 100644 --- a/lib/build/recipe/passwordless/types.d.ts +++ b/lib/build/recipe/passwordless/types.d.ts @@ -18,6 +18,7 @@ import type { ComponentOverride } from "../../components/componentOverride/compo import type { APIFormField, FeatureBaseConfig, + Navigate, NormalisedBaseConfig, UserContext, WebJSRecipeInterface, @@ -250,6 +251,7 @@ export declare type SignInUpEPComboEmailOrPhoneFormProps = { recipeImplementation: RecipeImplementation; config: NormalisedConfig; validatePhoneNumber: (phoneNumber: string) => Promise | string | undefined; + navigate: Navigate | undefined; }; export declare type SignInUpEPComboEmailFormProps = { showPasswordField: boolean; @@ -277,6 +279,7 @@ export declare type SignInUpEPComboEmailFormProps = { recipeImplementation: RecipeImplementation; validatePhoneNumber: (phoneNumber: string) => Promise | string | undefined; config: NormalisedConfig; + navigate: Navigate | undefined; }; export declare type MFAAction = | { @@ -336,6 +339,7 @@ export declare type SignInUpEPComboChildProps = Omit } ) => void; validatePhoneNumber: (phoneNumber: string) => Promise | string | undefined; + navigate: Navigate | undefined; }; export declare type LinkSentChildProps = LinkSentThemeProps; export declare type MFAChildProps = Omit; diff --git a/lib/build/recipe/recipeModule/index.d.ts b/lib/build/recipe/recipeModule/index.d.ts index c83e68e16..32305aa25 100644 --- a/lib/build/recipe/recipeModule/index.d.ts +++ b/lib/build/recipe/recipeModule/index.d.ts @@ -9,7 +9,7 @@ export default abstract class RecipeModule< > extends BaseRecipeModule { redirect: ( context: NormalisedGetRedirectionURLContext, - navigate?: Navigate, + navigate: Navigate | undefined, queryParams?: Record, userContext?: UserContext ) => Promise; diff --git a/lib/ts/recipe/passwordless/components/features/signInAndUpEPCombo/index.tsx b/lib/ts/recipe/passwordless/components/features/signInAndUpEPCombo/index.tsx index 2e808e4a8..c1ade4544 100644 --- a/lib/ts/recipe/passwordless/components/features/signInAndUpEPCombo/index.tsx +++ b/lib/ts/recipe/passwordless/components/features/signInAndUpEPCombo/index.tsx @@ -233,6 +233,7 @@ export function useChildProps( recipeImplementation: recipeImplementation, config: recipe.config, validatePhoneNumber: recipe.config.validatePhoneNumber ?? defaultPhoneNumberValidator, + navigate, }; }, [ error, @@ -242,6 +243,7 @@ export function useChildProps( isPhoneNumber, showPasswordField, showContinueWithPasswordlessLink, + navigate, ]); } diff --git a/lib/ts/recipe/passwordless/components/themes/signInUpEPCombo/emailForm.tsx b/lib/ts/recipe/passwordless/components/themes/signInUpEPCombo/emailForm.tsx index 06560aa56..7884f74dd 100644 --- a/lib/ts/recipe/passwordless/components/themes/signInUpEPCombo/emailForm.tsx +++ b/lib/ts/recipe/passwordless/components/themes/signInUpEPCombo/emailForm.tsx @@ -59,10 +59,13 @@ export const EPComboEmailForm = withOverride(