diff --git a/src/pages/admin/edit.astro b/src/pages/admin/edit.astro index 2834787..ef1dd44 100644 --- a/src/pages/admin/edit.astro +++ b/src/pages/admin/edit.astro @@ -70,7 +70,7 @@ import SiteLayout from '../../components/SiteLayout.astro'; const response = await fetch(getApiUrl(`content/${fileParam}`), { headers: { - 'Authorization': 'Basic ' + btoa('admin:password') // In production, use proper auth + // Authorization header removed; browser will handle Basic Auth prompt } }); @@ -111,8 +111,8 @@ import SiteLayout from '../../components/SiteLayout.astro'; const response = await fetch(url, { method: isNewFile ? 'POST' : 'PUT', headers: { - 'Content-Type': 'application/json', - 'Authorization': 'Basic ' + btoa('admin:password') // In production, use proper auth + 'Content-Type': 'application/json' + // Authorization header removed; browser will handle Basic Auth prompt }, body: JSON.stringify({ filename, content }) }); diff --git a/src/pages/admin/index.astro b/src/pages/admin/index.astro index eb445b8..eeec557 100644 --- a/src/pages/admin/index.astro +++ b/src/pages/admin/index.astro @@ -31,7 +31,7 @@ import SiteLayout from '../../components/SiteLayout.astro'; const response = await fetch(apiUrl, { headers: { - 'Authorization': 'Basic ' + btoa('admin:password') // In production, use proper auth + // Authorization header removed; browser will handle Basic Auth prompt } }); @@ -74,7 +74,7 @@ import SiteLayout from '../../components/SiteLayout.astro'; const response = await fetch(apiUrl, { method: 'DELETE', headers: { - 'Authorization': 'Basic ' + btoa('admin:password') // In production, use proper auth + 'Content-Type': 'application/json' } }); diff --git a/src/pages/admin/login.astro b/src/pages/admin/login.astro index ff87482..b6c6f08 100644 --- a/src/pages/admin/login.astro +++ b/src/pages/admin/login.astro @@ -1,49 +1,6 @@ --- -import SiteLayout from '../../components/SiteLayout.astro'; - -let error = ''; -if (Astro.request.method === 'POST') { - try { - const data = await Astro.request.formData(); - const username = data.get('username'); - const password = data.get('password'); - - // Simple client-side auth - real auth happens in the API - if (username === 'admin' && password === 'password') { - // Store authentication in a cookie or localStorage in a real app - return Astro.redirect('/admin'); - } else { - error = 'Invalid username or password'; - } - } catch (e) { - error = 'An error occurred during login'; - } -} +// src/pages/admin/login.astro +// This page now just redirects to the main admin dashboard. +// The API's Basic Auth will protect the actual data. +return Astro.redirect('/admin'); --- - - -
-

Content Admin Login

- - {error &&
{error}
} - -
-
- - -
- -
- - -
- - -
-
-