Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions lib/build/recipe/webauthn/api/implementation.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 9 additions & 10 deletions lib/ts/recipe/webauthn/api/implementation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1078,29 +1078,28 @@ export default function getAPIImplementation(): APIInterface {
return generatedOptions;
}

const email = generatedOptions.email;
if (email !== loginMethod.email) {
return {
status: "GENERAL_ERROR",
message: "Email mismatch",
};
}

// NOTE: Following checks will likely never throw an error as the
// check for type is done in a parent function but they are kept
// here to be on the safe side.
if (!email) {
if (!generatedOptions.email) {
throw new Error(
"Should never come here since we already check that the email value is a string in validateEmailAddress"
);
}

if (generatedOptions.email !== loginMethod.email) {
return {
status: "GENERAL_ERROR",
message: "Email mismatch",
};
}

// we are using the email from the register options
const registerCredentialResponse = await options.recipeImplementation.registerCredential({
webauthnGeneratedOptionsId,
credential,
userContext,
recipeUserId: session.getRecipeUserId().getAsString(),
recipeUserId,
});

if (registerCredentialResponse.status !== "OK") {
Expand Down
Loading