fix(auth): Sitzungs-Cookie auch ueber http nutzbar, Anmeldung als Formular (#013)
Das Cookie erhielt im Produktionsbau immer Secure und wurde ueber http vom Browser verworfen – nach der Anmeldung landete jeder Klick wieder auf der Anmeldeseite. Massgeblich ist jetzt das Schema in APP_URL. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,24 +1,12 @@
|
||||
"use client";
|
||||
|
||||
import { useActionState } from "react";
|
||||
import { anmelden } from "@/server/actions/auth";
|
||||
import type { AktionsErgebnis } from "@/server/actions/kunden";
|
||||
|
||||
const LEER: AktionsErgebnis = {};
|
||||
|
||||
/**
|
||||
* Anmeldeformular. Es sendet ganz gewöhnlich an eine Route – dadurch funktioniert die
|
||||
* Anmeldung auch ohne JavaScript, und das Sitzungs-Cookie kommt mit einer normalen Antwort.
|
||||
*/
|
||||
export function AnmeldeFormular({ ziel }: { ziel: string }) {
|
||||
const [ergebnis, aktion, laeuft] = useActionState(anmelden, LEER);
|
||||
|
||||
return (
|
||||
<form action={aktion}>
|
||||
<form method="post" action="/api/auth/anmelden">
|
||||
<input type="hidden" name="ziel" value={ziel} />
|
||||
|
||||
{ergebnis.fehler ? (
|
||||
<div className="alert alert-danger py-2" role="alert">
|
||||
{ergebnis.fehler}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div className="mb-3">
|
||||
<label className="form-label" htmlFor="email">
|
||||
E-Mail-Adresse
|
||||
@@ -47,8 +35,8 @@ export function AnmeldeFormular({ ziel }: { ziel: string }) {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<button type="submit" className="btn btn-primary w-100 pl-touch-target" disabled={laeuft}>
|
||||
{laeuft ? "Meldet an …" : "Anmelden"}
|
||||
<button type="submit" className="btn btn-primary w-100 pl-touch-target">
|
||||
Anmelden
|
||||
</button>
|
||||
</form>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user