Skip to content

Commit

Permalink
fix: impl
Browse files Browse the repository at this point in the history
  • Loading branch information
sattvikc committed Jul 7, 2023
1 parent c95d8ef commit 1a2547f
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 16 deletions.
1 change: 1 addition & 0 deletions lib/build/recipe/emailpassword/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
11 changes: 8 additions & 3 deletions lib/build/recipe/emailpassword/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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* () {
Expand Down
7 changes: 1 addition & 6 deletions lib/build/recipe/emailpassword/recipeImplementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions lib/build/recipe/emailpassword/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
3 changes: 3 additions & 0 deletions lib/ts/recipe/emailpassword/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
}

Expand Down
9 changes: 2 additions & 7 deletions lib/ts/recipe/emailpassword/recipeImplementation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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",
Expand Down
1 change: 1 addition & 0 deletions lib/ts/recipe/emailpassword/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ export default function getRecipeInterface(
password?: string;
userContext: any;
applyPasswordPolicy?: boolean;
tenantIdForPasswordPolicy: string;
}
): Promise<
| {
Expand Down

0 comments on commit 1a2547f

Please sign in to comment.