diff --git a/lib/build/recipe/emailpassword/index.d.ts b/lib/build/recipe/emailpassword/index.d.ts index 654045cc6..b230b3a82 100644 --- a/lib/build/recipe/emailpassword/index.d.ts +++ b/lib/build/recipe/emailpassword/index.d.ts @@ -68,6 +68,7 @@ export default class Wrapper { password?: string; userContext?: any; applyPasswordPolicy?: boolean; + tenantIdForPasswordPolicy?: string; }): Promise< | { status: "OK" | "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; diff --git a/lib/build/recipe/emailpassword/index.js b/lib/build/recipe/emailpassword/index.js index c942897ef..7c31cf370 100644 --- a/lib/build/recipe/emailpassword/index.js +++ b/lib/build/recipe/emailpassword/index.js @@ -101,9 +101,14 @@ class Wrapper { }); } static updateEmailOrPassword(input) { - return recipe_1.default - .getInstanceOrThrowError() - .recipeInterfaceImpl.updateEmailOrPassword(Object.assign({ userContext: {} }, input)); + return recipe_1.default.getInstanceOrThrowError().recipeInterfaceImpl.updateEmailOrPassword( + Object.assign(Object.assign({ userContext: {} }, input), { + tenantIdForPasswordPolicy: + input.tenantIdForPasswordPolicy === undefined + ? constants_1.DEFAULT_TENANT_ID + : input.tenantIdForPasswordPolicy, + }) + ); } static createResetPasswordLink(userId, tenantId, userContext) { return __awaiter(this, void 0, void 0, function* () { diff --git a/lib/build/recipe/emailpassword/recipeImplementation.js b/lib/build/recipe/emailpassword/recipeImplementation.js index 70a277b2b..5ab61cd8b 100644 --- a/lib/build/recipe/emailpassword/recipeImplementation.js +++ b/lib/build/recipe/emailpassword/recipeImplementation.js @@ -159,12 +159,7 @@ function getRecipeInterface(querier, getEmailPasswordConfig) { const passwordField = formFields.filter( (el) => el.id === constants_1.FORM_FIELD_PASSWORD_ID )[0]; - const error = yield passwordField.validate( - input.password, - input.tenantIdForPasswordPolicy === undefined - ? constants_2.DEFAULT_TENANT_ID - : input.tenantIdForPasswordPolicy - ); + const error = yield passwordField.validate(input.password, input.tenantIdForPasswordPolicy); if (error !== undefined) { return { status: "PASSWORD_POLICY_VIOLATED_ERROR", diff --git a/lib/build/recipe/emailpassword/types.d.ts b/lib/build/recipe/emailpassword/types.d.ts index 8ec43989d..53c0e1bae 100644 --- a/lib/build/recipe/emailpassword/types.d.ts +++ b/lib/build/recipe/emailpassword/types.d.ts @@ -136,6 +136,7 @@ export declare type RecipeInterface = { password?: string; userContext: any; applyPasswordPolicy?: boolean; + tenantIdForPasswordPolicy: string; }): Promise< | { status: "OK" | "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; diff --git a/lib/ts/recipe/emailpassword/index.ts b/lib/ts/recipe/emailpassword/index.ts index 064cf7afb..ed87edf58 100644 --- a/lib/ts/recipe/emailpassword/index.ts +++ b/lib/ts/recipe/emailpassword/index.ts @@ -80,10 +80,13 @@ export default class Wrapper { password?: string; userContext?: any; applyPasswordPolicy?: boolean; + tenantIdForPasswordPolicy?: string; }) { return Recipe.getInstanceOrThrowError().recipeInterfaceImpl.updateEmailOrPassword({ userContext: {}, ...input, + tenantIdForPasswordPolicy: + input.tenantIdForPasswordPolicy === undefined ? DEFAULT_TENANT_ID : input.tenantIdForPasswordPolicy, }); } diff --git a/lib/ts/recipe/emailpassword/recipeImplementation.ts b/lib/ts/recipe/emailpassword/recipeImplementation.ts index d443c1fcd..31265e005 100644 --- a/lib/ts/recipe/emailpassword/recipeImplementation.ts +++ b/lib/ts/recipe/emailpassword/recipeImplementation.ts @@ -158,7 +158,7 @@ export default function getRecipeInterface( email?: string; password?: string; applyPasswordPolicy?: boolean; - tenantIdForPasswordPolicy?: string; + tenantIdForPasswordPolicy: string; }): Promise< | { status: "OK" | "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; @@ -169,12 +169,7 @@ export default function getRecipeInterface( let formFields = getEmailPasswordConfig().signUpFeature.formFields; if (input.password !== undefined) { const passwordField = formFields.filter((el) => el.id === FORM_FIELD_PASSWORD_ID)[0]; - const error = await passwordField.validate( - input.password, - input.tenantIdForPasswordPolicy === undefined - ? DEFAULT_TENANT_ID - : input.tenantIdForPasswordPolicy - ); + const error = await passwordField.validate(input.password, input.tenantIdForPasswordPolicy); if (error !== undefined) { return { status: "PASSWORD_POLICY_VIOLATED_ERROR", diff --git a/lib/ts/recipe/emailpassword/types.ts b/lib/ts/recipe/emailpassword/types.ts index cd79ab47b..ad678e7f5 100644 --- a/lib/ts/recipe/emailpassword/types.ts +++ b/lib/ts/recipe/emailpassword/types.ts @@ -138,6 +138,7 @@ export type RecipeInterface = { password?: string; userContext: any; applyPasswordPolicy?: boolean; + tenantIdForPasswordPolicy: string; }): Promise< | { status: "OK" | "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; diff --git a/lib/ts/recipe/thirdpartyemailpassword/recipeImplementation/emailPasswordRecipeImplementation.ts b/lib/ts/recipe/thirdpartyemailpassword/recipeImplementation/emailPasswordRecipeImplementation.ts index 853e8f7c2..0d2c7a2e3 100644 --- a/lib/ts/recipe/thirdpartyemailpassword/recipeImplementation/emailPasswordRecipeImplementation.ts +++ b/lib/ts/recipe/thirdpartyemailpassword/recipeImplementation/emailPasswordRecipeImplementation.ts @@ -67,6 +67,7 @@ export default function getRecipeInterface(recipeInterface: ThirdPartyEmailPassw password?: string; userContext: any; applyPasswordPolicy: boolean; + tenantIdForPasswordPolicy: string; }): Promise< | { status: "OK" | "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; diff --git a/lib/ts/recipe/thirdpartyemailpassword/recipeImplementation/index.ts b/lib/ts/recipe/thirdpartyemailpassword/recipeImplementation/index.ts index 4ff5912bc..fe6c22a46 100644 --- a/lib/ts/recipe/thirdpartyemailpassword/recipeImplementation/index.ts +++ b/lib/ts/recipe/thirdpartyemailpassword/recipeImplementation/index.ts @@ -169,6 +169,7 @@ export default function getRecipeInterface( password?: string; userContext: any; applyPasswordPolicy?: boolean; + tenantIdForPasswordPolicy: string; } ): Promise< | {