From 41c87bedff63e2c3527690b6fd6c2cecddc8546e Mon Sep 17 00:00:00 2001 From: rishabhpoddar Date: Mon, 1 Jul 2024 19:51:15 +0530 Subject: [PATCH] more changes related to isEmailChangeAllowed --- .../common-customizations/change-email.mdx | 12 ------------ .../common-customizations/change-email.mdx | 12 ------------ 2 files changed, 24 deletions(-) diff --git a/v2/passwordless/common-customizations/change-email.mdx b/v2/passwordless/common-customizations/change-email.mdx index a77627837..69209b626 100644 --- a/v2/passwordless/common-customizations/change-email.mdx +++ b/v2/passwordless/common-customizations/change-email.mdx @@ -109,7 +109,6 @@ import Passwordless from "supertokens-node/recipe/passwordless"; import { verifySession } from "supertokens-node/recipe/session/framework/express"; import { SessionRequest } from "supertokens-node/framework/express" import express from "express"; -import {isEmailChangeAllowed} from "supertokens-node/recipe/accountlinking" let app = express(); @@ -124,11 +123,6 @@ app.post("/change-email", verifySession(), async (req: SessionRequest, res: expr // TODO: handle invalid email error return } - - if (!(await isEmailChangeAllowed(session.getRecipeUserId(), email, false))) { - // this can come here if you have enabled the account linking feature, and - // if there is a security risk in changing this user's email. - } // Update the email let resp = await Passwordless.updateUser({ @@ -450,12 +444,6 @@ app.post("/change-email", verifySession(), async (req: SessionRequest, res: expr return } - if (!(await isEmailChangeAllowed(session.getRecipeUserId(), email, true))) { - // this can come here if you have enabled the account linking feature, and - // if there is a security risk in changing this user's email. - return res.status(400).send("Email change not allowed. Please contact support"); - } - // Since the email is verified, we try and do an update let resp = await Passwordless.updateUser({ recipeUserId: session.getRecipeUserId(), diff --git a/v2/thirdpartypasswordless/common-customizations/change-email.mdx b/v2/thirdpartypasswordless/common-customizations/change-email.mdx index ff3adc391..124124f5f 100644 --- a/v2/thirdpartypasswordless/common-customizations/change-email.mdx +++ b/v2/thirdpartypasswordless/common-customizations/change-email.mdx @@ -111,7 +111,6 @@ import { verifySession } from "supertokens-node/recipe/session/framework/express import { SessionRequest } from "supertokens-node/framework/express" import express from "express"; import supertokens from "supertokens-node"; -import {isEmailChangeAllowed} from "supertokens-node/recipe/accountlinking" let app = express(); @@ -143,11 +142,6 @@ app.post("/change-email", verifySession(), async (req: SessionRequest, res: expr } } - if (!(await isEmailChangeAllowed(session.getRecipeUserId(), email, false))) { - // this can come here if you have enabled the account linking feature, and - // if there is a security risk in changing this user's email. - } - // Update the email let resp = await Passwordless.updateUser({ recipeUserId: session.getRecipeUserId(), @@ -497,12 +491,6 @@ app.post("/change-email", verifySession(), async (req: SessionRequest, res: expr return } - if (!(await isEmailChangeAllowed(session.getRecipeUserId(), email, true))) { - // this can come here if you have enabled the account linking feature, and - // if there is a security risk in changing this user's email. - return res.status(400).send("Email change not allowed. Please contact support"); - } - // Since the email is verified, we try and do an update let resp = await Passwordless.updateUser({ recipeUserId: session.getRecipeUserId(),