mirror of https://github.com/wg-easy/wg-easy
4 changed files with 82 additions and 6 deletions
@ -0,0 +1,13 @@ |
|||||
|
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 }; |
||||
|
} |
||||
|
); |
Loading…
Reference in new issue