Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/modules/auth/auth.actions.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// src/modules/auth/auth.actions.ts
import { defineAction, ActionError } from 'astro:actions';
import { SignJWT } from 'jose';
import { loginSchema } from './auth.schema';
Expand All @@ -11,7 +12,6 @@ export const login = defineAction({

// 1. Validate Credentials against Environment Secrets
if (email !== env.ADMIN_EMAIL || password !== env.ADMIN_PASSWORD) {
// High security, standard code format for authentication blocks
throw new ActionError({
code: "UNAUTHORIZED",
message: "Invalid email or password."
Expand All @@ -34,8 +34,7 @@ export const login = defineAction({
httpOnly: true,
secure: true,
sameSite: 'lax',
domain: context.url.hostname,
maxAge: 60 * 60 * 24,
maxAge: 60 * 60 * 24, // 24 hours
});

return { success: true };
Expand Down
Loading