Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Update auth-password-service.ts

Daniel Hougaard677180548bea
diff --git a/backend/src/services/auth/auth-password-service.ts b/backend/src/services/auth/auth-password-service.ts
index 14fb582585..bf3482be5a 100644
--- a/backend/src/services/auth/auth-password-service.ts
+++ b/backend/src/services/auth/auth-password-service.ts
@@ -189,16 +189,15 @@ export const authPaswordServiceFactory = ({
throw new BadRequestError({ message: `User encryption key not found for user with ID '${userId}'` });
}
- if (!user.hashedPassword) {
- throw new BadRequestError({ message: "Unable to reset password, no password is set" });
- }
-
if (!user.authMethods?.includes(AuthMethod.EMAIL)) {
throw new BadRequestError({ message: "Unable to reset password, no email authentication method is configured" });
}
// we check the old password if the user is resetting their password while logged in
if (type === ResetPasswordV2Type.LoggedInReset) {
+ if (!user.hashedPassword) {
+ throw new BadRequestError({ message: "Unable to change password, no password is set" });
+ }
if (!oldPassword) {
throw new BadRequestError({ message: "Current password is required." });
}