add password reset + password change

This commit is contained in:
Emily
2025-01-13 17:01:34 +01:00
parent ab95772dd4
commit 88ebfc188c
9 changed files with 416 additions and 5 deletions

View File

@@ -0,0 +1,10 @@
import { PasswordModel } from "@schema/PasswordSchema";
export default defineEventHandler(async event => {
const userData = getRequestUser(event);
if (!userData?.logged) return;
const hasPassword = await PasswordModel.exists({ email: userData.user.email });
if (hasPassword) return { can_change: true };
return { can_change: false }
});