Skip to content

Commit b983a3e

Browse files
Add some fixes for requested changes
1 parent c304741 commit b983a3e

File tree

5 files changed

+19
-82
lines changed

5 files changed

+19
-82
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ import FormBase from "../../../../emailpassword/components/library/formBase";
2525
import { defaultEmailValidator } from "../../../../emailpassword/validators";
2626
import { RecoverableError } from "../error/recoverableError";
2727

28-
import type { RecoverFromProps } from "../../../types";
28+
import type { RecoverFormProps } from "../../../types";
2929

3030
export const PasskeyRecoverAccountForm = withOverride(
3131
"PasskeyRecoverAccountForm",
3232
(
33-
props: RecoverFromProps & {
33+
props: RecoverFormProps & {
3434
setError: React.Dispatch<React.SetStateAction<string | undefined>>;
3535
}
3636
): JSX.Element => {
@@ -87,9 +87,15 @@ export const PasskeyRecoverAccountForm = withOverride(
8787
}
8888
);
8989

90+
<<<<<<< Updated upstream
9091
export const PasskeyRecoverAccount = withOverride(
9192
"PasskeyRecoverAccount",
9293
(props: RecoverFromProps): JSX.Element => {
94+
=======
95+
export const PasskeyRecoverAccountForm = withOverride(
96+
"PasskeyRecoverAccountForm",
97+
(props: RecoverFormProps): JSX.Element => {
98+
>>>>>>> Stashed changes
9399
const t = useTranslation();
94100
const [errorLabel, setErrorLabel] = useState<string | undefined>(undefined);
95101

lib/ts/recipe/webauthn/functionOverrides.ts

Lines changed: 9 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -7,48 +7,16 @@ export const getFunctionOverrides =
77
(originalImp: RecipeInterface): RecipeInterface => ({
88
...originalImp,
99
getRegisterOptions: async function (input) {
10-
const response = await originalImp.getRegisterOptions(input);
11-
12-
if (response.status === "OK") {
13-
onHandleEvent({
14-
action: "REGISTER_OPTIONS",
15-
});
16-
}
17-
18-
return response;
10+
return await originalImp.getRegisterOptions(input);
1911
},
2012
getSignInOptions: async function (input) {
21-
const response = await originalImp.getSignInOptions(input);
22-
23-
if (response.status === "OK") {
24-
onHandleEvent({
25-
action: "SIGN_IN_OPTIONS",
26-
});
27-
}
28-
29-
return response;
13+
return await originalImp.getSignInOptions(input);
3014
},
3115
signIn: async function (input) {
32-
const response = await originalImp.signIn(input);
33-
34-
if (response.status === "OK") {
35-
onHandleEvent({
36-
action: "SIGN_IN",
37-
});
38-
}
39-
40-
return response;
16+
return await originalImp.signIn(input);
4117
},
4218
signUp: async function (input) {
43-
const response = await originalImp.signUp(input);
44-
45-
if (response.status === "OK") {
46-
onHandleEvent({
47-
action: "SIGN_UP",
48-
});
49-
}
50-
51-
return response;
19+
return await originalImp.signUp(input);
5220
},
5321
getEmailExists: async function (input) {
5422
const response = await originalImp.getEmailExists(input);
@@ -63,26 +31,10 @@ export const getFunctionOverrides =
6331
return response;
6432
},
6533
generateRecoverAccountToken: async function (input) {
66-
const response = await originalImp.generateRecoverAccountToken(input);
67-
68-
if (response.status === "OK") {
69-
onHandleEvent({
70-
action: "GENERATE_RECOVER_ACCOUNT_TOKEN",
71-
});
72-
}
73-
74-
return response;
34+
return await originalImp.generateRecoverAccountToken(input);
7535
},
7636
recoverAccount: async function (input) {
77-
const response = await originalImp.recoverAccount(input);
78-
79-
if (response.status === "OK") {
80-
onHandleEvent({
81-
action: "RECOVER_ACCOUNT",
82-
});
83-
}
84-
85-
return response;
37+
return await originalImp.recoverAccount(input);
8638
},
8739
registerCredential: async function (input) {
8840
const response = await originalImp.registerCredential(input);
@@ -109,11 +61,7 @@ export const getFunctionOverrides =
10961
registerCredentialWithSignUp: async function (input) {
11062
const response = await originalImp.registerCredentialWithSignUp(input);
11163

112-
if (response.status === "OK") {
113-
onHandleEvent({
114-
action: "REGISTER_CREDENTIAL_WITH_SIGN_UP",
115-
});
116-
} else if (response.status === "FAILED_TO_REGISTER_USER") {
64+
if (response.status === "FAILED_TO_REGISTER_USER") {
11765
onHandleEvent({
11866
action: "FAILED_TO_REGISTER_USER",
11967
});
@@ -122,25 +70,9 @@ export const getFunctionOverrides =
12270
return response;
12371
},
12472
authenticateCredentialWithSignIn: async function (input) {
125-
const response = await originalImp.authenticateCredentialWithSignIn(input);
126-
127-
if (response.status === "OK") {
128-
onHandleEvent({
129-
action: "AUTHENTICATE_CREDENTIAL_WITH_SIGN_IN",
130-
});
131-
}
132-
133-
return response;
73+
return await originalImp.authenticateCredentialWithSignIn(input);
13474
},
13575
registerCredentialWithRecoverAccount: async function (input) {
136-
const response = await originalImp.registerCredentialWithRecoverAccount(input);
137-
138-
if (response.status === "OK") {
139-
onHandleEvent({
140-
action: "REGISTER_CREDENTIAL_WITH_RECOVER_ACCOUNT",
141-
});
142-
}
143-
144-
return response;
76+
return await originalImp.registerCredentialWithRecoverAccount(input);
14577
},
14678
});

lib/ts/recipe/webauthn/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ export type FeatureBlockDetailProps = {
197197
icon: JSX.Element;
198198
};
199199

200-
export type RecoverFromProps = {
200+
export type RecoverFormProps = {
201201
onSuccess: (result: any) => void;
202202
onBackClick: () => void;
203203
recipeImplementation: RecipeImplementation;

stories/allrecipes.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export const RecoverAccountWithToken: Story = {
138138
"multifactorauth.initialized": false,
139139
"passwordless.initialized": false,
140140
"webauthn.initialized": true,
141-
query: "token=asdf&[email protected]",
141+
query: "token=asdf",
142142
},
143143
};
144144

stories/utils.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ export type FirstFactor =
106106
| "link-email"
107107
| "thirdparty"
108108
| "emailpassword"
109-
| "webauthn-sign-up";
110109
export type ProviderId = "google" | "github";
111110

112111
export type AuthPageConf = {

0 commit comments

Comments
 (0)