refactor(api): ♻️ Remove password2 from password resets (done on client)

This commit is contained in:
Jesse Wierzbinski 2024-07-22 21:29:02 +02:00
parent 0645203d97
commit d4894c362e
No known key found for this signature in database

View file

@ -24,7 +24,6 @@ export const schemas = {
form: z.object({
token: z.string().min(1),
password: z.string().min(3).max(100),
password2: z.string().min(3).max(100),
}),
};
@ -51,7 +50,7 @@ export default (app: Hono) =>
meta.route,
zValidator("form", schemas.form, handleZodError),
async (context) => {
const { token, password, password2 } = context.req.valid("form");
const { token, password } = context.req.valid("form");
const user = await User.fromSql(
eq(Users.passwordResetToken, token),
@ -61,14 +60,6 @@ export default (app: Hono) =>
return returnError(token, "invalid_token", "Invalid token");
}
if (password !== password2) {
return returnError(
token,
"password_mismatch",
"Passwords do not match",
);
}
await user.update({
password: await Bun.password.hash(password),
passwordResetToken: null,