- Customer accounts now require email verification (hashed, single-use, time-limited tokens) before they can request/confirm bookings, with resend flows on login/account/booking widget and rate limiting. - Admins get a private, rotatable iCalendar (ICS) subscription feed of their confirmed bookings and public events, timezone-correct for Europe/Berlin including DST, never exposing meeting passwords. - Adds a full SEO layer: per-page canonical/OG/Twitter metadata with CMS-editable overrides and content-derived fallbacks, a dynamic sitemap.xml and robots.txt driven by real published content, JSON-LD (Organization/LocalBusiness, WebSite, WebPage, BreadcrumbList, Service, Event, BlogPosting) that never fabricates data, and a CMS-managed redirect table for changed slugs. - Global ANOUMA-naming audit: the brand name is never used to label personal account/calendar areas anywhere in the app, CMS, or emails. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
75 lines
2.6 KiB
TypeScript
75 lines
2.6 KiB
TypeScript
"use client";
|
|
|
|
import { useState, type FormEvent } from "react";
|
|
import { useRouter, useSearchParams } from "next/navigation";
|
|
import { ResendVerificationButton } from "./ResendVerificationButton";
|
|
|
|
const fieldClass =
|
|
"w-full rounded-2xl border border-anouma-taupe/30 bg-white px-5 py-3.5 text-base text-anouma-plum placeholder:text-anouma-plum/50 focus:border-anouma-mauve-dark focus:outline-none";
|
|
|
|
export function LoginForm() {
|
|
const router = useRouter();
|
|
const searchParams = useSearchParams();
|
|
const [error, setError] = useState<string | null>(null);
|
|
const [loading, setLoading] = useState(false);
|
|
|
|
async function handleSubmit(e: FormEvent<HTMLFormElement>) {
|
|
e.preventDefault();
|
|
setError(null);
|
|
setLoading(true);
|
|
|
|
const data = new FormData(e.currentTarget);
|
|
const email = String(data.get("email") ?? "");
|
|
const password = String(data.get("password") ?? "");
|
|
|
|
try {
|
|
const res = await fetch("/api/customers/login", {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
credentials: "include",
|
|
body: JSON.stringify({ email, password }),
|
|
});
|
|
if (!res.ok) {
|
|
setError("E-Mail oder Passwort ist nicht korrekt.");
|
|
setLoading(false);
|
|
return;
|
|
}
|
|
router.push(searchParams.get("next") || "/konto");
|
|
router.refresh();
|
|
} catch {
|
|
setError("Verbindung fehlgeschlagen. Bitte versuche es erneut.");
|
|
setLoading(false);
|
|
}
|
|
}
|
|
|
|
return (
|
|
<form onSubmit={handleSubmit} className="space-y-5">
|
|
<div>
|
|
<label htmlFor="email" className="mb-2 block text-sm font-medium text-anouma-plum">
|
|
E-Mail
|
|
</label>
|
|
<input id="email" name="email" type="email" required className={fieldClass} autoComplete="email" />
|
|
</div>
|
|
<div>
|
|
<label htmlFor="password" className="mb-2 block text-sm font-medium text-anouma-plum">
|
|
Passwort
|
|
</label>
|
|
<input id="password" name="password" type="password" required className={fieldClass} autoComplete="current-password" />
|
|
</div>
|
|
{error && (
|
|
<p role="alert" className="text-sm text-red-700">
|
|
{error}
|
|
</p>
|
|
)}
|
|
<button
|
|
type="submit"
|
|
disabled={loading}
|
|
className="w-full rounded-full bg-anouma-mauve-dark px-7 py-3.5 text-sm font-medium tracking-wide text-white transition-colors duration-300 hover:bg-anouma-plum disabled:opacity-60"
|
|
>
|
|
{loading ? "Wird geprüft …" : "Anmelden"}
|
|
</button>
|
|
<ResendVerificationButton variant="email-prompt" className="pt-1" />
|
|
</form>
|
|
);
|
|
}
|