diff --git a/src/routes/auth/login.ts b/src/routes/auth/login.ts index 6eed9c99..c633bcb1 100644 --- a/src/routes/auth/login.ts +++ b/src/routes/auth/login.ts @@ -1,12 +1,14 @@ import { auth } from "@/lib/auth/lucia"; import type { LoginBody } from "@/lib/types/auth"; import { responseHeaders } from "@/lib/responseHeaders"; -import "lucia/polyfill/node" // required for old node versions +import "lucia/polyfill/node"; // required for old nodejs versions export const login = async (request: Request): Promise => { const body = (await request.json()) as LoginBody; const { username, password } = body; + // TODO: in-depth error handling + if (!username || !password) { return new Response( JSON.stringify({ diff --git a/src/routes/auth/signup.ts b/src/routes/auth/signup.ts index 0b59bad3..20f57ec9 100644 --- a/src/routes/auth/signup.ts +++ b/src/routes/auth/signup.ts @@ -6,6 +6,8 @@ export const signup = async (request: Request): Promise => { const body = (await request.json()) as RegisterBody; const { username, password, email, passwordConfirm } = body; + // TODO: in-depth error handling + if (!username || !password || !email || !passwordConfirm) { return new Response( JSON.stringify({ diff --git a/src/routes/auth/validate.ts b/src/routes/auth/validate.ts index 95e7373e..66fe1088 100644 --- a/src/routes/auth/validate.ts +++ b/src/routes/auth/validate.ts @@ -5,6 +5,8 @@ export const validate = async (request: Request): Promise => { const authRequest = auth.handleRequest(request); const session = await authRequest.validate(); + // TODO: in-depth error handling + if (!session) { return new Response( JSON.stringify({