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

+40
View File
@@ -0,0 +1,40 @@
import nodemailer from "nodemailer";
import { env } from "../src/config/env";
// Verifies the SMTP connection configured via env, and optionally sends a test mail.
// Run with production env: set -a; . ./.env; set +a; pnpm tsx scripts/check-smtp.ts [recipient]
async function main() {
const recipient = process.argv[2];
const transport = nodemailer.createTransport({
host: env.SMTP_HOST,
port: env.SMTP_PORT,
secure: env.SMTP_PORT === 465,
auth: { user: env.SMTP_USER, pass: env.SMTP_PASSWORD },
});
console.log(
`Verifying SMTP ${env.SMTP_HOST}:${env.SMTP_PORT} (secure=${env.SMTP_PORT === 465}) as ${env.SMTP_USER}, from=${env.SMTP_FROM} …`,
);
await transport.verify();
console.log("OK: SMTP connection verified.");
if (recipient) {
const info = await transport.sendMail({
from: env.SMTP_FROM,
to: recipient,
subject: "Redaktionsportal — SMTP-Test",
text: "Test-E-Mail vom Redaktionsportal. Wenn diese ankommt, ist SMTP korrekt verbunden.",
});
console.log(`OK: test mail sent to ${recipient} (messageId=${info.messageId}).`);
}
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error("FAILED: SMTP check failed:", error?.message ?? error);
process.exit(1);
});