mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 15:58:38 +01:00
add password reset + password change
This commit is contained in:
10
dashboard/server/api/user/password/can_change.ts
Normal file
10
dashboard/server/api/user/password/can_change.ts
Normal 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 }
|
||||
});
|
||||
Reference in New Issue
Block a user