reboot alterflixhub
This commit is contained in:
commit
1e84023a44
188 files changed
+31629
No files matched your search
@@ -0,0 +1,22 @@
|
||||
import { createError, defineEventHandler, readBody } from "h3";
|
||||
|
||||
import { createAdminSession, isValidCredentials } from "@/lib/admin-auth.server";
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const body = (await readBody(event)) as {
|
||||
username?: string;
|
||||
password?: string;
|
||||
};
|
||||
const username = (body?.username ?? "").trim();
|
||||
const password = body?.password ?? "";
|
||||
|
||||
if (!isValidCredentials(username, password)) {
|
||||
throw createError({
|
||||
statusCode: 401,
|
||||
statusMessage: "ชื่อผู้ใช้หรือรหัสผ่านไม่ถูกต้อง",
|
||||
});
|
||||
}
|
||||
|
||||
createAdminSession(event);
|
||||
return { ok: true };
|
||||
});
|
||||
Reference in new issue
Block a user