feat(api): implement /api/user/me/password endpoint
Some checks failed
container-scan / Container Scan (pull_request) Failing after 33s
docker-build / docker (pull_request) Failing after 5m11s

add an endpoint to allow the user to change his password
This commit is contained in:
Dominik 2025-06-23 09:51:06 +02:00
parent be1502a4ac
commit 280fa57e45
Signed by: dominik
GPG key ID: 06A4003FC5049644
3 changed files with 171 additions and 0 deletions

View file

@ -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',
});