This commit is contained in:
@@ -1,9 +1,18 @@
|
||||
---
|
||||
import Layout from '../layouts/Layout.astro';
|
||||
import { Icon } from 'astro-icon/components';
|
||||
|
||||
if (Astro.locals.user) {
|
||||
return Astro.redirect('/dashboard');
|
||||
}
|
||||
|
||||
const error = Astro.url.searchParams.get('error');
|
||||
const errorMessage =
|
||||
error === 'invalid_credentials'
|
||||
? 'Invalid email or password'
|
||||
: error === 'missing_fields'
|
||||
? 'Please fill in all fields'
|
||||
: null;
|
||||
---
|
||||
|
||||
<Layout title="Login - Chronus">
|
||||
@@ -14,6 +23,13 @@ if (Astro.locals.user) {
|
||||
<h2 class="text-3xl font-bold text-center mb-2">Welcome Back</h2>
|
||||
<p class="text-center text-base-content/60 mb-6">Sign in to continue to Chronus</p>
|
||||
|
||||
{errorMessage && (
|
||||
<div role="alert" class="alert alert-error mb-4">
|
||||
<Icon name="heroicons:exclamation-circle" class="w-6 h-6" />
|
||||
<span>{errorMessage}</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<form action="/api/auth/login" method="POST" class="space-y-4">
|
||||
<label class="form-control">
|
||||
<div class="label">
|
||||
|
||||
Reference in New Issue
Block a user