"""Owner password-reset email (#19), following the same sender-resolution/template/mailer.send_email shape as booking_mail.py's booking confirmation -- see that module for why this never talks to smtplib directly. """ import os from flask import render_template import booking_mail import mailer PUBLIC_BASE_URL = os.environ.get("PUBLIC_BASE_URL", "https://onboard.mivanchenko.de").rstrip("/") def reset_url(token): return f"{PUBLIC_BASE_URL}/owner/reset-password/{token}" def send_password_reset(client, user, token): business_name = (client or {}).get("business_name") or "Ihr Konto" html = render_template( "emails/password_reset.html", business_name=business_name, reset_url=reset_url(token), ) mailer.send_email( user["email"], f"Passwort zurücksetzen – {business_name}", html, from_addr=booking_mail._sender_for(client), )