Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions apps/backend/src/controllers/auth/passwordResetHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,12 @@ export const forgotPassword = async (req: Request, res: Response) => {
const user = await prisma.user.findUnique({ where: { email } });

// Always 200 — never reveal whether email is registered.
// Google-only accounts can also use this flow to set their first local password;
// resetPassword upserts the local identity on the way through.
if (!user || !user.emailVerified) {
return res.status(200).json(GENERIC_OK);
}

// Google-only accounts have no local identity — they cannot reset a password.
const localIdentity = await prisma.authIdentity.findFirst({
where: { userId: user.id, provider: "local" },
});
if (!localIdentity) {
return res.status(200).json(GENERIC_OK);
}

const { rawToken } = await createEmailToken(
user.id,
"reset_password",
Expand Down
Loading