Skip to content

Commit 64da711

Browse files
Add fixes for making the sign up component buttons work properly
1 parent bc37a5b commit 64da711

File tree

5 files changed

+10
-11
lines changed

5 files changed

+10
-11
lines changed

lib/ts/recipe/webauthn/components/features/signUp/index.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ export function useChildProps(
4545
onError: (err: string) => void,
4646
userContext: UserContext,
4747
clearError: () => void,
48-
resetFactorList: () => void
48+
resetFactorList: () => void,
49+
onSignInUpSwitcherClick: () => void
4950
): SignUpThemeProps {
5051
const session = useSessionContext();
5152
const recipeImplementation = recipe.webJSRecipe;
@@ -85,6 +86,7 @@ export function useChildProps(
8586
recipeImplementation: recipeImplementation,
8687
config: recipe.config,
8788
resetFactorList: resetFactorList,
89+
onSignInUpSwitcherClick,
8890
};
8991
}, [error, factorIds, userContext, recipeImplementation]);
9092
}
@@ -109,7 +111,8 @@ const SignUpFeatureInner: React.FC<
109111
props.onError,
110112
userContext,
111113
props.clearError,
112-
props.resetFactorList
114+
props.resetFactorList,
115+
props.onSignInUpSwitcherClick
113116
)!;
114117

115118
return (

lib/ts/recipe/webauthn/components/themes/signUp/index.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ function SignUpTheme(props: SignUpThemeProps): JSX.Element {
2929

3030
const activeStyle = props.config.signUpFeature.style;
3131

32-
// TODO: Define a way to reset the factor list.
33-
// const handleResetFactorList = () => {
34-
// return null;
35-
// };
36-
3732
const stInstance = SuperTokens.getInstanceOrThrow();
3833

3934
const privacyPolicyLink = stInstance.privacyPolicyLink;
@@ -50,7 +45,7 @@ function SignUpTheme(props: SignUpThemeProps): JSX.Element {
5045
<AuthPageHeader
5146
factorIds={props.factorIds}
5247
isSignUp={true}
53-
onSignInUpSwitcherClick={undefined}
48+
onSignInUpSwitcherClick={props.onSignInUpSwitcherClick}
5449
hasSeparateSignUpView={true}
5550
resetFactorList={props.resetFactorList}
5651
showBackButton={true}

lib/ts/recipe/webauthn/components/themes/signUp/signUpForm.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ export const SignUpForm = withOverride(
3434

3535
const defaultFooter = (
3636
<div data-supertokens="continueWithoutPasskey">
37-
<a
38-
onClick={() => alert("That is not defined yet!")}
39-
data-supertokens="formLabelLinkBtn continueWithoutPasskeyLabel">
37+
<a onClick={props.resetFactorList} data-supertokens="formLabelLinkBtn continueWithoutPasskeyLabel">
4038
{t("WEBAUTHN_CONTINUE_WITHOUT_PASSKEY_BUTTON")}
4139
</a>
4240
</div>

lib/ts/recipe/webauthn/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ export type SignUpThemeProps = {
146146
error: string | undefined;
147147
userContext: UserContext;
148148
resetFactorList: () => void;
149+
onSignInUpSwitcherClick: () => void;
149150
};
150151

151152
export type SignUpFormProps = {
@@ -156,6 +157,7 @@ export type SignUpFormProps = {
156157
recipeImplementation: RecipeImplementation;
157158
config: NormalisedConfig;
158159
onSuccess?: (result: { createdNewRecipeUser: boolean; user: User }) => void;
160+
resetFactorList: () => void;
159161
};
160162

161163
// Type to indicate what the `Continue with` button is being used for.

lib/ts/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ export type UserContext = Record<string, any>;
423423
export type AuthComponentProps = {
424424
setFactorList: (factorIds: string[]) => void;
425425
resetFactorList: () => void;
426+
onSignInUpSwitcherClick: () => void;
426427
rebuildAuthPage: () => void;
427428
onAuthSuccess: (successContext: AuthSuccessContext) => Promise<void>;
428429
navigate: Navigate | undefined;

0 commit comments

Comments
 (0)