feat(api): implement /api/user/me/password endpoint
add an endpoint to allow the user to change his password
This commit is contained in:
parent
be1502a4ac
commit
280fa57e45
3 changed files with 171 additions and 0 deletions
|
@ -4,6 +4,7 @@ import {
|
|||
lastNameSchema,
|
||||
newUserEmailServerSchema,
|
||||
newUserNameServerSchema,
|
||||
passwordSchema,
|
||||
} from '@/app/api/user/validation';
|
||||
|
||||
// ----------------------------------------
|
||||
|
@ -19,3 +20,11 @@ export const updateUserServerSchema = zod.object({
|
|||
image: zod.string().optional(),
|
||||
timezone: zod.string().optional(),
|
||||
});
|
||||
|
||||
export const updateUserPasswordServerSchema = zod.object({
|
||||
current_password: zod.string().min(1, 'Current password is required'),
|
||||
new_password: passwordSchema,
|
||||
confirm_new_password: passwordSchema,
|
||||
}).refine((data) => data.new_password === data.confirm_new_password, {
|
||||
message: 'New password and confirm new password must match',
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue