From 5500a2dddefeaf361b5423e8fa77c3ec33e13b22 Mon Sep 17 00:00:00 2001 From: rishabhpoddar Date: Thu, 12 Sep 2024 14:21:39 +0530 Subject: [PATCH] fixes snippet --- .../ep-migration-without-password-hash.mdx | 14 +++----------- .../ep-migration-without-password-hash.mdx | 14 +++----------- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/v2/emailpassword/migration/account-creation/ep-migration-without-password-hash.mdx b/v2/emailpassword/migration/account-creation/ep-migration-without-password-hash.mdx index 712d4ab85..678b00a4c 100644 --- a/v2/emailpassword/migration/account-creation/ep-migration-without-password-hash.mdx +++ b/v2/emailpassword/migration/account-creation/ep-migration-without-password-hash.mdx @@ -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) { @@ -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 ( @@ -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) diff --git a/v2/thirdpartyemailpassword/migration/account-creation/ep-migration-without-password-hash.mdx b/v2/thirdpartyemailpassword/migration/account-creation/ep-migration-without-password-hash.mdx index 2ab9d98b3..8e555693d 100644 --- a/v2/thirdpartyemailpassword/migration/account-creation/ep-migration-without-password-hash.mdx +++ b/v2/thirdpartyemailpassword/migration/account-creation/ep-migration-without-password-hash.mdx @@ -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) { @@ -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 ( @@ -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)