Skip to content

Commit

Permalink
fix(core): fix rebase issue
Browse files Browse the repository at this point in the history
fix rebase issue
  • Loading branch information
simeng-li committed Jul 22, 2024
1 parent 0aa6eae commit f9f66ef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,13 @@ export default class ExperienceInteraction {
);

if (password) {
await this.#profile.encryptAndSetPassword(password);
await this.#profile.setPasswordDigest(password);
}
}

Check warning on line 234 in packages/core/src/routes/experience/classes/experience-interaction.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/routes/experience/classes/experience-interaction.ts#L206-L234

Added lines #L206 - L234 were not covered by tests

public async resetPassword(password: string) {
await this.getIdentifiedUser();
await this.#profile.encryptAndSetPassword(password, true);
await this.#profile.setPasswordDigest(password, true);
}

Check warning on line 239 in packages/core/src/routes/experience/classes/experience-interaction.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/routes/experience/classes/experience-interaction.ts#L237-L239

Added lines #L237 - L239 were not covered by tests

/**
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/routes/experience/classes/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@ export class Profile {
* @throws {RequestError} 422 if the password does not meet the password policy.
* @throws {RequestError} 422 if the password is the same as the current user's password.
*/
async encryptAndSetPassword(password: string, reset = false) {
async setPasswordDigest(password: string, reset = false) {
const user = await this.getUserFromContext();
const passwordPolicy = await this.signInExperienceValidator.getPasswordPolicy();
const passwordValidator = new PasswordValidator(passwordPolicy, user);
await passwordValidator.validatePassword(password, this.#data);
const encryptedPasswordData = await passwordValidator.encryptPassword(password);
const passwordDigests = await passwordValidator.createPasswordDigest(password);

if (!reset) {
this.profileValidator.guardProfileNotExistInCurrentUserAccount(user, encryptedPasswordData);
this.profileValidator.guardProfileNotExistInCurrentUserAccount(user, passwordDigests);
}

this.unsafeSet(encryptedPasswordData);
this.unsafeSet(passwordDigests);
}

Check warning on line 65 in packages/core/src/routes/experience/classes/profile.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/routes/experience/classes/profile.ts#L54-L65

Added lines #L54 - L65 were not covered by tests

/**
Expand Down

0 comments on commit f9f66ef

Please sign in to comment.