Skip to content

Commit

Permalink
fixes snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
rishabhpoddar committed Sep 12, 2024
1 parent a1c4773 commit 5500a2d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1117,14 +1117,9 @@ EmailPassword.init({
await EmailVerification.verifyEmailUsingToken("public", generateEmailVerificationTokenResponse.token, undefined, input.userContext);
}
}
emailPasswordUser = signUpResponse.user;
}
// highlight-start
emailPasswordUser = supertokensUsersWithSameEmail.find(u => {
return u.loginMethods.find(lM => lM.hasSameEmailAs(email) && lM.recipeId === "emailpassword") !== undefined;
})
if (emailPasswordUser === undefined) {
throw new Error("Should never come here")
}
// Check if the user signing in has a temporary password
let userMetadata = await UserMetadata.getUserMetadata(emailPasswordUser.id, input.userContext)
if (userMetadata.status === "OK" && userMetadata.metadata.isUsingTemporaryPassword) {
Expand Down Expand Up @@ -1265,10 +1260,8 @@ def override_emailpassword_apis(original_implementation: APIInterface):
user_context,
)

emailpassword_user = response.user
# highlight-start
emailpassword_user = await get_user_by_email(tenant_id, email, user_context)
if emailpassword_user is None:
raise Exception("Should never come here")
# Check if the user signing in has a temporary password
metadata_result = await get_user_metadata(emailpassword_user.user_id)
if (
Expand Down Expand Up @@ -1414,10 +1407,9 @@ func main() {
}
}
}
emailPasswordUser = &response.OK.User
}

emailPasswordUser, err = emailpassword.GetUserByEmail(tenantId, email)

// Check if the user signing in has a temporary password
metadata, err := usermetadata.GetUserMetadata(emailPasswordUser.ID)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1117,14 +1117,9 @@ EmailPassword.init({
await EmailVerification.verifyEmailUsingToken("public", generateEmailVerificationTokenResponse.token, undefined, input.userContext);
}
}
emailPasswordUser = signUpResponse.user;
}
// highlight-start
emailPasswordUser = supertokensUsersWithSameEmail.find(u => {
return u.loginMethods.find(lM => lM.hasSameEmailAs(email) && lM.recipeId === "emailpassword") !== undefined;
})
if (emailPasswordUser === undefined) {
throw new Error("Should never come here")
}
// Check if the user signing in has a temporary password
let userMetadata = await UserMetadata.getUserMetadata(emailPasswordUser.id, input.userContext)
if (userMetadata.status === "OK" && userMetadata.metadata.isUsingTemporaryPassword) {
Expand Down Expand Up @@ -1265,10 +1260,8 @@ def override_emailpassword_apis(original_implementation: APIInterface):
user_context,
)

emailpassword_user = response.user
# highlight-start
emailpassword_user = await get_user_by_email(tenant_id, email, user_context)
if emailpassword_user is None:
raise Exception("Should never come here")
# Check if the user signing in has a temporary password
metadata_result = await get_user_metadata(emailpassword_user.user_id)
if (
Expand Down Expand Up @@ -1414,10 +1407,9 @@ func main() {
}
}
}
emailPasswordUser = &response.OK.User
}

emailPasswordUser, err = emailpassword.GetUserByEmail(tenantId, email)

// Check if the user signing in has a temporary password
metadata, err := usermetadata.GetUserMetadata(emailPasswordUser.ID)

Expand Down

0 comments on commit 5500a2d

Please sign in to comment.