diff --git a/packages/core/src/routes/experience/classes/validators/password-validator.ts b/packages/core/src/routes/experience/classes/validators/password-validator.ts index 0b6c1dd6f9ea..edc0693200ac 100644 --- a/packages/core/src/routes/experience/classes/validators/password-validator.ts +++ b/packages/core/src/routes/experience/classes/validators/password-validator.ts @@ -32,8 +32,8 @@ export class PasswordValidator { } /** - * Validate password against the given password policy - * throw a {@link RequestError} 422 if the password is invalid; otherwise, do nothing. + * Validate password against the password policy + * @throws {RequestError} with status 422 if the password does not meet the policy */ public async validatePassword(password: string, profile: InteractionProfile) { const userInfo = getUserInfo({ @@ -51,7 +51,7 @@ export class PasswordValidator { } } - public async encryptPassword(password: string) { + public async createPasswordDigest(password: string) { return encryptUserPassword(password); } } diff --git a/packages/core/src/routes/experience/classes/verifications/new-password-identity-verification.ts b/packages/core/src/routes/experience/classes/verifications/new-password-identity-verification.ts index 89c7c487fc3c..8b51787f87d6 100644 --- a/packages/core/src/routes/experience/classes/verifications/new-password-identity-verification.ts +++ b/packages/core/src/routes/experience/classes/verifications/new-password-identity-verification.ts @@ -104,9 +104,8 @@ export class NewPasswordIdentityVerification const passwordValidator = new PasswordValidator(passwordPolicy); await passwordValidator.validatePassword(password, identifierProfile); - const { passwordEncrypted, passwordEncryptionMethod } = await passwordValidator.encryptPassword( - password - ); + const { passwordEncrypted, passwordEncryptionMethod } = + await passwordValidator.createPasswordDigest(password); this.passwordEncrypted = passwordEncrypted; this.passwordEncryptionMethod = passwordEncryptionMethod;