mirror of https://github.com/wg-easy/wg-easy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
418 B
13 lines
418 B
import { UserUpdatePasswordSchema } from '#db/repositories/user/types';
|
|
|
|
export default definePermissionEventHandler(
|
|
actions.CLIENT,
|
|
async ({ event, user }) => {
|
|
const { newPassword, currentPassword } = await readValidatedBody(
|
|
event,
|
|
validateZod(UserUpdatePasswordSchema)
|
|
);
|
|
await Database.users.updatePassword(user.id, currentPassword, newPassword);
|
|
return { success: true };
|
|
}
|
|
);
|
|
|