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 25, 2024
1 parent 49a0c50 commit 453c8af
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);
}
}

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

/**
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);
}

/**
Expand Down

0 comments on commit 453c8af

Please sign in to comment.