feat: require old password for password reset (#488)

* feat: require old password for password reset
This commit is contained in:
Udit Takkar
2023-10-04 09:53:57 +05:30
committed by Mythie
parent 02bb7e4d68
commit 78d2401d44
4 changed files with 63 additions and 13 deletions

View File

@ -67,11 +67,12 @@ export const profileRouter = router({
.input(ZUpdatePasswordMutationSchema)
.mutation(async ({ input, ctx }) => {
try {
const { password } = input;
const { password, currentPassword } = input;
return await updatePassword({
userId: ctx.user.id,
password,
currentPassword,
});
} catch (err) {
let message =

View File

@ -10,6 +10,7 @@ export const ZUpdateProfileMutationSchema = z.object({
});
export const ZUpdatePasswordMutationSchema = z.object({
currentPassword: z.string().min(6),
password: z.string().min(6),
});