Skip to content

Commit 41c87be

Browse files
committed
more changes related to isEmailChangeAllowed
1 parent 1be5640 commit 41c87be

File tree

2 files changed

+0
-24
lines changed

2 files changed

+0
-24
lines changed

v2/passwordless/common-customizations/change-email.mdx

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ import Passwordless from "supertokens-node/recipe/passwordless";
109109
import { verifySession } from "supertokens-node/recipe/session/framework/express";
110110
import { SessionRequest } from "supertokens-node/framework/express"
111111
import express from "express";
112-
import {isEmailChangeAllowed} from "supertokens-node/recipe/accountlinking"
113112

114113
let app = express();
115114

@@ -124,11 +123,6 @@ app.post("/change-email", verifySession(), async (req: SessionRequest, res: expr
124123
// TODO: handle invalid email error
125124
return
126125
}
127-
128-
if (!(await isEmailChangeAllowed(session.getRecipeUserId(), email, false))) {
129-
// this can come here if you have enabled the account linking feature, and
130-
// if there is a security risk in changing this user's email.
131-
}
132126

133127
// Update the email
134128
let resp = await Passwordless.updateUser({
@@ -450,12 +444,6 @@ app.post("/change-email", verifySession(), async (req: SessionRequest, res: expr
450444
return
451445
}
452446

453-
if (!(await isEmailChangeAllowed(session.getRecipeUserId(), email, true))) {
454-
// this can come here if you have enabled the account linking feature, and
455-
// if there is a security risk in changing this user's email.
456-
return res.status(400).send("Email change not allowed. Please contact support");
457-
}
458-
459447
// Since the email is verified, we try and do an update
460448
let resp = await Passwordless.updateUser({
461449
recipeUserId: session.getRecipeUserId(),

v2/thirdpartypasswordless/common-customizations/change-email.mdx

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ import { verifySession } from "supertokens-node/recipe/session/framework/express
111111
import { SessionRequest } from "supertokens-node/framework/express"
112112
import express from "express";
113113
import supertokens from "supertokens-node";
114-
import {isEmailChangeAllowed} from "supertokens-node/recipe/accountlinking"
115114

116115
let app = express();
117116

@@ -143,11 +142,6 @@ app.post("/change-email", verifySession(), async (req: SessionRequest, res: expr
143142
}
144143
}
145144

146-
if (!(await isEmailChangeAllowed(session.getRecipeUserId(), email, false))) {
147-
// this can come here if you have enabled the account linking feature, and
148-
// if there is a security risk in changing this user's email.
149-
}
150-
151145
// Update the email
152146
let resp = await Passwordless.updateUser({
153147
recipeUserId: session.getRecipeUserId(),
@@ -497,12 +491,6 @@ app.post("/change-email", verifySession(), async (req: SessionRequest, res: expr
497491
return
498492
}
499493

500-
if (!(await isEmailChangeAllowed(session.getRecipeUserId(), email, true))) {
501-
// this can come here if you have enabled the account linking feature, and
502-
// if there is a security risk in changing this user's email.
503-
return res.status(400).send("Email change not allowed. Please contact support");
504-
}
505-
506494
// Since the email is verified, we try and do an update
507495
let resp = await Passwordless.updateUser({
508496
recipeUserId: session.getRecipeUserId(),

0 commit comments

Comments
 (0)