diff --git a/app/admin/page.tsx b/app/admin/page.tsx
index 20e7425..432a91d 100644
--- a/app/admin/page.tsx
+++ b/app/admin/page.tsx
@@ -151,6 +151,17 @@ export default function AdminPage() {
}
};
+ const handleLogout = () => {
+ localStorage.removeItem('hoerdle_admin_auth');
+ setIsAuthenticated(false);
+ setPassword('');
+ // Reset all state
+ setSongs([]);
+ setGenres([]);
+ setSpecials([]);
+ setDailyPuzzles([]);
+ };
+
// Helper function to add auth headers to requests
const getAuthHeaders = () => {
const authToken = localStorage.getItem('hoerdle_admin_auth');
@@ -779,7 +790,24 @@ export default function AdminPage() {
return (
-
Hördle Admin Dashboard
+
+
Hördle Admin Dashboard
+
+
{/* Special Management */}
diff --git a/lib/auth.ts b/lib/auth.ts
index 45169ce..3496676 100644
--- a/lib/auth.ts
+++ b/lib/auth.ts
@@ -22,6 +22,16 @@ export async function requireAdminAuth(request: NextRequest): Promise {
const bcrypt = await import('bcryptjs');
+
+ // Validate that ADMIN_PASSWORD is set (security best practice)
+ if (!process.env.ADMIN_PASSWORD) {
+ console.error('SECURITY WARNING: ADMIN_PASSWORD environment variable is not set!');
+ // Fallback to default hash only in development
+ if (process.env.NODE_ENV === 'production') {
+ throw new Error('ADMIN_PASSWORD environment variable is required in production');
+ }
+ }
+
const adminPasswordHash = process.env.ADMIN_PASSWORD || '$2b$10$SHOt9G1qUNIvHoWre7499.eEtp5PtOII0daOQGNV.dhDEuPmOUdsq';
return bcrypt.compare(password, adminPasswordHash);
}