```astro --- import Layout from '../../layouts/Layout.astro'; import { validateAdminLogin } from '../../lib/admin/auth'; let error = null; if (Astro.request.method === 'POST') { const data = await Astro.request.formData(); const username = data.get('username')?.toString() || ''; const password = data.get('password')?.toString() || ''; const isValid = await validateAdminLogin(username, password); if (isValid) { return Astro.redirect('/admin'); } else { error = 'Usuário ou senha incorretos'; } } ---
```