mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-19 08:26:07 +00:00
Update Login to use email
This commit is contained in:
parent
3f9c764acd
commit
45e817672c
@ -4,7 +4,7 @@ import jwt from 'jsonwebtoken';
|
|||||||
import prisma from "@/app/prisma";
|
import prisma from "@/app/prisma";
|
||||||
|
|
||||||
interface Body {
|
interface Body {
|
||||||
username: string;
|
email: string;
|
||||||
password: string;
|
password: string;
|
||||||
remember?: boolean;
|
remember?: boolean;
|
||||||
}
|
}
|
||||||
@ -13,13 +13,13 @@ export async function POST(request: NextRequest) {
|
|||||||
try {
|
try {
|
||||||
const body: Body = await request.json();
|
const body: Body = await request.json();
|
||||||
|
|
||||||
if (!body.username || !body.password) {
|
if (!body.email || !body.password) {
|
||||||
return NextResponse.json({ error: "Missing required fields" }, { status: 400 });
|
return NextResponse.json({ error: "Missing required fields" }, { status: 400 });
|
||||||
}
|
}
|
||||||
|
|
||||||
const user = await prisma.user.findUnique({
|
const user = await prisma.user.findUnique({
|
||||||
where: {
|
where: {
|
||||||
username: body.username,
|
email: body.email,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -22,6 +22,6 @@
|
|||||||
"@/*": ["./*"]
|
"@/*": ["./*"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "app/api/user/login"],
|
||||||
"exclude": ["node_modules"]
|
"exclude": ["node_modules"]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user