fix: wire editorial approval, harden registration, set production auth URL

- Wire admin approval UI to editorialService.approveEditorial so editorial
  accounts can move pending_approval -> active and log in. The approve button
  was permanently disabled and the service unreachable, so editorial users
  could never sign in.
- Surface non-validation errors (e.g. SMTP failures) on the registration
  form instead of silently redirecting to the confirmation page.
- Set BETTER_AUTH_URL default to the production domain in .env.example and
  compose.yaml so verification/reset links and the login origin check
  resolve against the live origin.
- Add scripts/check-smtp.ts to verify SMTP connectivity against the
  configured transport.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Leon TonhäuserandClaude committed 2026-08-10 23:06:13 +02:00
1 parent 907beb6e42
commit 268ea7544e
8 files changed
+228 -12

No files matched your search

+2
View File
@@ -7,6 +7,7 @@ import { authClient } from "./client";
export type RegistrationFormState = {
errors?: Partial<
Record<
| "form"
| "companyName"
| "contactName"
| "email"
@@ -47,6 +48,7 @@ export function RegistrationForm({
return (
<form action={formAction} className="account-form">
<FieldError message={state.errors?.form} />
<div className="form-grid">
<label>
Redaktion oder Unternehmen
+34 -9
View File
@@ -1,5 +1,7 @@
import Link from "next/link";
import { approveEditorialAction } from "@/app/admin/redaktionen/[id]/actions";
export type EditorialDetail = {
id: string;
name: string;
@@ -14,6 +16,14 @@ export function EditorialDetailContent({
editorial,
hasActiveGrant,
}: Readonly<{ editorial: EditorialDetail; hasActiveGrant: boolean }>) {
const emailVerified = Boolean(editorial.emailVerifiedAt);
const canApprove = hasActiveGrant && emailVerified;
const approvalHint = !emailVerified
? "Eine Freigabe ist erst möglich, nachdem die E-Mail-Adresse bestätigt wurde."
: hasActiveGrant
? "Mit der Freigabe wird der Nettopreis festgelegt und die Redaktion kann sich anmelden."
: "Eine Freigabe ist erst möglich, wenn mindestens ein aktives Albumrecht zugewiesen wurde.";
return (
<section className="content-section" aria-labelledby="editorial-title">
<p className="eyebrow">Redaktion</p>
@@ -37,15 +47,30 @@ export function EditorialDetailContent({
<section aria-labelledby="approval-title">
<h2 id="approval-title">Freigabe</h2>
<button type="button" disabled aria-describedby="approval-help">
Redaktion freigeben
</button>
<p id="approval-help">
{hasActiveGrant
? "Mindestens ein Albumrecht ist zugewiesen. Die Freigabe bleibt bis zur weiteren Verwaltungsoberfläche deaktiviert."
: "Eine Freigabe ist erst möglich, wenn mindestens ein aktives Albumrecht zugewiesen wurde."}
</p>
<Link href={`/admin/redaktionen/${editorial.id}/alben`}>Albumrechte verwalten</Link>
{editorial.status === "active" ? (
<p>Die Redaktion ist freigegeben (Netto {formatCents(editorial.currentPriceCents ?? 0)}).</p>
) : (
<>
<form action={approveEditorialAction.bind(null, editorial.id)} className="account-form">
<label>
Individueller Nettopreis (EUR)
<input
inputMode="decimal"
min="0.01"
name="priceEuros"
required
step="0.01"
type="number"
/>
</label>
<button type="submit" disabled={!canApprove}>
Redaktion freigeben
</button>
</form>
<p>{approvalHint}</p>
<Link href={`/admin/redaktionen/${editorial.id}/alben`}>Albumrechte verwalten</Link>
</>
)}
</section>
</section>
);