Skip to content

Commit

Permalink
more changes related to isEmailChangeAllowed
Browse files Browse the repository at this point in the history
  • Loading branch information
rishabhpoddar committed Jul 1, 2024
1 parent 1be5640 commit 41c87be
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 24 deletions.
12 changes: 0 additions & 12 deletions v2/passwordless/common-customizations/change-email.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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({
Expand Down Expand Up @@ -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(),
Expand Down
12 changes: 0 additions & 12 deletions v2/thirdpartypasswordless/common-customizations/change-email.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down

0 comments on commit 41c87be

Please sign in to comment.