Aktueller Stand

This commit is contained in:
2026-01-18 00:40:01 +01:00
parent 68b63b8f06
commit 31aef02558
16 changed files with 352 additions and 43 deletions

View File

@@ -1,12 +1,11 @@
"use client";
import Link from "next/link";
import { signIn } from "next-auth/react";
import { useEffect, useState } from "react";
export default function RegisterPage() {
const [error, setError] = useState<string | null>(null);
const [done, setDone] = useState(false);
const [showVerifyLink, setShowVerifyLink] = useState(false);
const [registrationEnabled, setRegistrationEnabled] = useState<boolean | null>(
null
);
@@ -28,6 +27,7 @@ export default function RegisterPage() {
const onSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
setError(null);
setShowVerifyLink(false);
const formData = new FormData(event.currentTarget);
const payload = {
@@ -48,12 +48,11 @@ export default function RegisterPage() {
return;
}
setDone(true);
await signIn("credentials", {
email: payload.email,
password: payload.password,
callbackUrl: "/"
});
const emailValue = String(payload.email || "").trim().toLowerCase();
const nextUrl = emailValue
? `/login?registered=1&email=${encodeURIComponent(emailValue)}`
: "/login?registered=1";
window.location.href = nextUrl;
};
return (
@@ -94,15 +93,20 @@ export default function RegisterPage() {
Konto anlegen
</button>
</form>
{done && (
<p className="mt-3 text-sm text-emerald-600">Account erstellt.</p>
)}
{error && <p className="mt-3 text-sm text-red-600">{error}</p>}
</>
)}
<p className="mt-4 text-sm text-slate-600">
Schon registriert? <Link href="/login" className="text-brand-700">Login</Link>
</p>
{showVerifyLink && (
<p className="mt-2 text-sm text-slate-600">
E-Mail nicht bestätigt?{" "}
<Link href="/verify" className="text-brand-700">
Link erneut senden
</Link>
</p>
)}
</div>
);
}