From 5293e9497d159d6d43293508429a5bbbb5358d64 Mon Sep 17 00:00:00 2001 From: Peter van Arkel Date: Tue, 24 Nov 2026 13:34:43 +0100 Subject: [PATCH] Keep welcome previews in bounds and brand invitation emails --- docs/deployment.md | 6 ++ pyproject.toml | 1 + .../hosting/account_administration.py | 6 +- src/coulobre/hosting/installation_views.py | 57 +++++++++++- src/coulobre/hosting/invitations.py | 83 ++++++++++++++---- .../0080_invitation_mail_settings.py | 45 ++++++++++ src/coulobre/hosting/models.py | 14 +++ .../static/hosting/coulobre-mail-mark.png | Bin 0 -> 3601 bytes src/coulobre/hosting/static/hosting/panel.css | 5 ++ .../hosting/feature_configuration.html | 6 ++ .../hosting/invitation_mail_settings.html | 19 ++++ .../templates/hosting/manage_invitation.html | 2 +- .../templates/hosting/panel_invitation.html | 14 +-- .../hosting/panel_invitation_body.html | 19 +++- .../templates/hosting/workspace_form.html | 7 +- .../hosting/test_panel_authentication.py | 36 ++++++++ src/coulobre/hosting/urls.py | 11 ++- src/coulobre/hosting/workspaces.py | 1 + 18 files changed, 297 insertions(+), 35 deletions(-) create mode 100644 src/coulobre/hosting/migrations/0080_invitation_mail_settings.py create mode 100644 src/coulobre/hosting/static/hosting/coulobre-mail-mark.png create mode 100644 src/coulobre/hosting/templates/hosting/invitation_mail_settings.html diff --git a/docs/deployment.md b/docs/deployment.md index 5f6cd5e..f257eb2 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -2771,6 +2771,12 @@ Operators can open **Contact and invitation** from **Show All Users** to review the welcome email and send a fresh password setup link to a pending login. Sending a new invitation replaces the previous link. +Verified server administrators can edit the welcome email sender in +**Server Manager → Operator Settings → Email → Edit sender**. Leave the +From address blank to use the address configured for the installation. +Choose a From address accepted by the SMTP relay. The optional Reply-to +address directs replies to a separate inbox. + Managers handle customer onboarding and hosting assignments in their portfolio. Customers manage their own website files, databases, mailboxes, and other hosting resources in the customer workspace. Operators can diff --git a/pyproject.toml b/pyproject.toml index 0f0b89b..755c1eb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,6 +47,7 @@ server = ["gunicorn>=27.0.1,<28"] "static/hosting/*.js", "static/hosting/*.css", "static/hosting/*.svg", + "static/hosting/*.png", "templates/*.html", "templates/hosting/*.conf", "templates/hosting/*.html", diff --git a/src/coulobre/hosting/account_administration.py b/src/coulobre/hosting/account_administration.py index 9e3e2a8..03aa1a4 100644 --- a/src/coulobre/hosting/account_administration.py +++ b/src/coulobre/hosting/account_administration.py @@ -29,7 +29,7 @@ from .installation_features import ( from .invitations import ( InviteLoginForm, queue_invitation, - render_welcome_message, + welcome_message_context, ) from .models import ( Customer, @@ -189,10 +189,10 @@ class CustomerOnboardingView(UserPassesTestMixin, FormView): data = form.cleaned_data if self.request.POST.get("action") == "preview": defaults = zone_defaults() - preview = render_welcome_message( + preview = welcome_message_context( username=data["username"], welcome_message=data["welcome_message"], - setup_url="[Personal password setup link]", + setup_url="", account=HostingAccount( primary_domain=data["primary_domain"], hosting_plan=data["plan"], diff --git a/src/coulobre/hosting/installation_views.py b/src/coulobre/hosting/installation_views.py index 744e6a9..43a2fd5 100644 --- a/src/coulobre/hosting/installation_views.py +++ b/src/coulobre/hosting/installation_views.py @@ -1,3 +1,4 @@ +from email.utils import parseaddr from importlib.metadata import PackageNotFoundError, version from django import forms @@ -15,7 +16,7 @@ from django.views.generic import FormView, TemplateView from .access import is_tenant from .installation_features import FEATURES, FeaturePolicy -from .models import PanelFeaturePolicy +from .models import InvitationMailSettings, PanelFeaturePolicy from .update_views import inspect_linked_nodes @@ -228,3 +229,57 @@ class FeatureConfigurationView(UserPassesTestMixin, FormView): return self.render_to_response( self.get_context_data(form=form), status=409 ) + + +class InvitationMailSettingsForm(forms.ModelForm): + class Meta: + model = InvitationMailSettings + fields = ("sender_name", "sender_address", "reply_to") + labels = { + "sender_name": "Sender display name", + "sender_address": "From address", + "reply_to": "Reply-to address", + } + help_texts = { + "sender_name": "Leave blank to use the installed sender name.", + "sender_address": "Use an address your SMTP server allows.", + "reply_to": "Leave blank to receive replies at the From address.", + } + + +@method_decorator(never_cache, name="dispatch") +class InvitationMailSettingsView(UserPassesTestMixin, FormView): + form_class = InvitationMailSettingsForm + template_name = "hosting/invitation_mail_settings.html" + success_url = reverse_lazy("panel:invitation_mail_settings") + + def test_func(self): + return ( + self.request.user.is_superuser and self.request.user.is_verified() + ) + + def get_form_kwargs(self): + return super().get_form_kwargs() | { + "instance": InvitationMailSettings.objects.filter(pk=1).first(), + } + + def get_context_data(self, **kwargs): + _, installed_address = parseaddr(settings.DEFAULT_FROM_EMAIL) + return super().get_context_data( + installed_address=installed_address, **kwargs + ) + + @transaction.atomic + def form_valid(self, form): + saved, _ = InvitationMailSettings.objects.update_or_create( + pk=1, defaults=form.cleaned_data + ) + if form.has_changed(): + LogEntry.objects.log_actions( + self.request.user.pk, + [saved], + CHANGE, + "Updated welcome email sender.", + ) + messages.success(self.request, "Welcome email sender saved.") + return super().form_valid(form) diff --git a/src/coulobre/hosting/invitations.py b/src/coulobre/hosting/invitations.py index cedb495..dd66045 100644 --- a/src/coulobre/hosting/invitations.py +++ b/src/coulobre/hosting/invitations.py @@ -1,5 +1,9 @@ import uuid from datetime import timedelta +from email.mime.image import MIMEImage +from email.mime.multipart import MIMEMultipart +from email.utils import parseaddr +from pathlib import Path from django import forms from django.conf import settings @@ -10,7 +14,8 @@ from django.contrib.auth.views import ( INTERNAL_RESET_SESSION_TOKEN, PasswordResetConfirmView, ) -from django.core.mail import send_mail +from django.core.mail import EmailMultiAlternatives +from django.core.mail.message import sanitize_address from django.core.signing import BadSignature, Signer from django.db import transaction from django.shortcuts import get_object_or_404, redirect @@ -27,7 +32,13 @@ from kombu.exceptions import OperationalError from .access import customer_for_user, is_tenant, reseller_for_user from .account_setup import website_records -from .models import Customer, HostingAccount, PanelInvitation, Reseller +from .models import ( + Customer, + HostingAccount, + InvitationMailSettings, + PanelInvitation, + Reseller, +) from .panel_factors import lock_user from .password_reset import reset_enabled @@ -170,16 +181,7 @@ def deliver_invitation(invitation_id, revision): ) context = invitation_message_context(user, setup_url=origin + path) try: - sent = send_mail( - "Welcome to Coulobre Panel", - render_to_string("hosting/panel_invitation.txt", context), - None, - [user.email], - html_message=render_to_string( - "hosting/panel_invitation.html", - {"invitation_content": context}, - ), - ) + sent = invitation_email(user.email, context).send() if sent != 1: raise OSError("The email backend did not accept the invitation.") except (OSError, ValueError): @@ -188,6 +190,57 @@ def deliver_invitation(invitation_id, revision): pending.update(delivery=PanelInvitation.Delivery.SENT) +class InvitationEmail(EmailMultiAlternatives): + def message(self): + message = super().message() + plain, html = message.get_payload() + logo_file = ( + Path(__file__).parent / "static/hosting/coulobre-mail-mark.png" + ) + logo = MIMEImage(logo_file.read_bytes(), _subtype="png") + logo.add_header("Content-ID", "") + logo.add_header("Content-Disposition", "inline") + related = MIMEMultipart( + "related", _subparts=[html, logo], type="text/html" + ) + message.set_payload([plain, related]) + return message + + +@sensitive_variables("context") +def invitation_email(recipient, context): + mail_settings = ( + InvitationMailSettings.objects.filter(pk=1).first() + or InvitationMailSettings() + ) + sender = settings.DEFAULT_FROM_EMAIL + if mail_settings.sender_name or mail_settings.sender_address: + name, address = parseaddr(sender) + sender = sanitize_address( + ( + mail_settings.sender_name or name, + mail_settings.sender_address or address, + ), + settings.DEFAULT_CHARSET, + ) + return InvitationEmail( + "Welcome to Coulobre Panel", + render_to_string("hosting/panel_invitation.txt", context), + sender, + [recipient], + reply_to=[mail_settings.reply_to] if mail_settings.reply_to else None, + alternatives=[ + ( + render_to_string( + "hosting/panel_invitation.html", + {"invitation_content": context}, + ), + "text/html", + ) + ], + ) + + def invitation_message_context(user, *, setup_url=""): invitation = getattr(user, "panel_invitation", None) account = ( @@ -249,12 +302,6 @@ def welcome_message_context( } -def render_welcome_message(**kwargs): - return render_to_string( - "hosting/panel_invitation.txt", welcome_message_context(**kwargs) - ) - - class AcceptInvitation(PasswordResetConfirmView): template_name = "hosting/accept_invitation.html" token_generator = invitation_token diff --git a/src/coulobre/hosting/migrations/0080_invitation_mail_settings.py b/src/coulobre/hosting/migrations/0080_invitation_mail_settings.py new file mode 100644 index 0000000..b289d2d --- /dev/null +++ b/src/coulobre/hosting/migrations/0080_invitation_mail_settings.py @@ -0,0 +1,45 @@ +# Generated by Django 5.2.19 on 2026-11-24 12:32 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("hosting", "0079_onboarding_dismissal"), + ] + + operations = [ + migrations.CreateModel( + name="InvitationMailSettings", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "sender_name", + models.CharField( + blank=True, + max_length=120, + validators=[ + django.core.validators.RegexValidator( + "\\A[^\\x00-\\x1f\\x7f]*\\Z", + "Enter a single-line name.", + ) + ], + ), + ), + ( + "sender_address", + models.EmailField(blank=True, max_length=254), + ), + ("reply_to", models.EmailField(blank=True, max_length=254)), + ], + ), + ] diff --git a/src/coulobre/hosting/models.py b/src/coulobre/hosting/models.py index 97d9cf6..85488f5 100644 --- a/src/coulobre/hosting/models.py +++ b/src/coulobre/hosting/models.py @@ -187,6 +187,20 @@ class PanelInvitation(models.Model): ) +class InvitationMailSettings(models.Model): + sender_name = models.CharField( + max_length=120, + blank=True, + validators=[ + RegexValidator( + r"\A[^\x00-\x1f\x7f]*\Z", "Enter a single-line name." + ) + ], + ) + sender_address = models.EmailField(blank=True) + reply_to = models.EmailField(blank=True) + + class CustomerImpersonation(models.Model): class EndReason(models.TextChoices): STOPPED = "stopped", "Ended by administrator" diff --git a/src/coulobre/hosting/static/hosting/coulobre-mail-mark.png b/src/coulobre/hosting/static/hosting/coulobre-mail-mark.png new file mode 100644 index 0000000000000000000000000000000000000000..194013edc92281512850b0d766adcc13fe45a730 GIT binary patch literal 3601 zcmV+s4({=ZP)iUB*rAINwg=cu{miLqe;!K z$x)Mt(IoChjK%>3Wf6u amul}$lqzP|f#CNnS_!vHhG_dDk?Gv7Qohj-t1?|t{( zcRv|AK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k{RYs9WS9>{fGZ}x8`#pi_I6a$f4p!1o28AE<2uC~}K-8GH|+0A?AXdb3o=RDYH5MLL|E3>xS+VkSiDXZC?QNe{# zSXjnu7}+zlr?7JQ%kc1MJ69}1+??#6a2FTA0cG}BCx|v(rGs{!NL>{(ffOmq?P}|k zj$fzD4XUi=RP zYL!l4zW*sV$YNsxVruBKPHZ%zCMO21DoPn}h68ZvQUh08>ZZN<-knfwx!Y5x;r{z( zX>|S#u8B@ULb6|+CRe7zkr4jic~STf4hTKWt)#Sq+YwS-C2X;1P4}1F%v;$e%Nj0Ha?#Bjv z*w6sB7aWdp-GO8ZdP~Sj+H|sf1;$_e@BbM#OfNAUrq8Kd#VJ*G`?wl-J1z3YTS6nR+%0Bn1hgNQwDA zY^T{BeGyTl(}}gBAe9o00v1!K~w_( X6FF +

Welcome email sender

+ Edit sender + + {% endif %} {% if selected_section == 'general' %}

Installation

diff --git a/src/coulobre/hosting/templates/hosting/invitation_mail_settings.html b/src/coulobre/hosting/templates/hosting/invitation_mail_settings.html new file mode 100644 index 0000000..c7ffd73 --- /dev/null +++ b/src/coulobre/hosting/templates/hosting/invitation_mail_settings.html @@ -0,0 +1,19 @@ +{% extends "hosting/workspace_page.html" %} +{% block title %}Welcome email sender · Coulobre Panel{% endblock %} +{% block page_title %}Welcome email sender{% endblock %} +{% block page_context %} + ← Email settings +{% endblock %} +{% block page_content %} +
+

These settings apply to welcome emails. Leave the From address blank to use {{ installed_address }}.

+
+ {% csrf_token %} + {{ form.as_div }} +
+ + Cancel +
+
+
+{% endblock %} diff --git a/src/coulobre/hosting/templates/hosting/manage_invitation.html b/src/coulobre/hosting/templates/hosting/manage_invitation.html index 38e9e6b..b0d9167 100644 --- a/src/coulobre/hosting/templates/hosting/manage_invitation.html +++ b/src/coulobre/hosting/templates/hosting/manage_invitation.html @@ -14,7 +14,7 @@ {% if welcome_preview %} -
+
Welcome email preview

A password setup link is added when the invitation is sent.

diff --git a/src/coulobre/hosting/templates/hosting/panel_invitation.html b/src/coulobre/hosting/templates/hosting/panel_invitation.html index 82e7d7a..f99ebe8 100644 --- a/src/coulobre/hosting/templates/hosting/panel_invitation.html +++ b/src/coulobre/hosting/templates/hosting/panel_invitation.html @@ -5,13 +5,17 @@ Welcome to Coulobre Panel - + -
-
- {% include "hosting/panel_invitation_body.html" with message=invitation_content email_format=True %} -
+
+ + + + +
+ {% include "hosting/panel_invitation_body.html" with message=invitation_content email_format=True %} +
diff --git a/src/coulobre/hosting/templates/hosting/panel_invitation_body.html b/src/coulobre/hosting/templates/hosting/panel_invitation_body.html index 7f26720..4451ae5 100644 --- a/src/coulobre/hosting/templates/hosting/panel_invitation_body.html +++ b/src/coulobre/hosting/templates/hosting/panel_invitation_body.html @@ -1,19 +1,30 @@ +{% load panel_assets %} + + + + + + Welcome to Coulobre Panel {% if message.welcome_message %}{{ message.welcome_message|linebreaks }}{% endif %}

Your hosting provider created a panel login for you. Set your password within 48 hours.

-

Username {{ message.username }}

+

Username
{{ message.username }}

{% if message.setup_url %} -

Set your password

+ + +
+ Set your password +
{% else %}

Set your password

{% endif %} {% if message.panel_url %}

Open Coulobre Panel

{% endif %} {% if message.account %}

Your hosting

-

Domain {{ message.account.primary_domain }}

+

Domain
{{ message.account.primary_domain }}

{% with package=message.account.hosting_plan %} {% if package %} -

Hosting package {{ package.name }}

+

Hosting package
{{ package.name }}

  • Websites · {{ package.website_limit }}
  • Scheduled tasks · {{ package.website_job_limit }}
  • diff --git a/src/coulobre/hosting/templates/hosting/workspace_form.html b/src/coulobre/hosting/templates/hosting/workspace_form.html index a395bee..b24ee9a 100644 --- a/src/coulobre/hosting/templates/hosting/workspace_form.html +++ b/src/coulobre/hosting/templates/hosting/workspace_form.html @@ -10,9 +10,12 @@ {% csrf_token %} {{ form.as_div }} {% if welcome_preview %} -
    +
    Welcome email preview -
    {{ welcome_preview|force_escape }}
    +

    A password setup link is added when the invitation is sent.

    +
    + {% include "hosting/panel_invitation_body.html" with message=welcome_preview %} +
    {% endif %} {% if moving %} diff --git a/src/coulobre/hosting/test_panel_authentication.py b/src/coulobre/hosting/test_panel_authentication.py index c303cf6..9ffb460 100644 --- a/src/coulobre/hosting/test_panel_authentication.py +++ b/src/coulobre/hosting/test_panel_authentication.py @@ -140,6 +140,19 @@ class PanelAuthenticationTests(TestCase): session = self.client.session session["otp_device_id"] = device.persistent_id session.save() + settings_url = reverse("panel:invitation_mail_settings") + config = { + "sender_name": "Hosting support", + "sender_address": "welcome@example.test", + "reply_to": "support@example.test", + } + self.assertRedirects( + self.client.post(settings_url, config), settings_url + ) + self.assertContains( + self.client.post(settings_url, config | {"reply_to": "invalid"}), + "Enter a valid email address.", + ) recipient = "new@example.test" def run_delivery(*, args, retry): @@ -167,6 +180,10 @@ class PanelAuthenticationTests(TestCase): self.assertEqual(len(mail.outbox), 1) invitation = mail.outbox[0] self.assertEqual(invitation.to, [recipient]) + self.assertEqual( + invitation.from_email, "Hosting support " + ) + self.assertEqual(invitation.reply_to, ["support@example.test"]) self.assertIn("Username: new-user", invitation.body) self.assertIn("48 hours", invitation.body) link = self.invitation_path(invitation.body) @@ -174,6 +191,15 @@ class PanelAuthenticationTests(TestCase): self.assertEqual(content_type, "text/html") self.assertIn("Welcome to Coulobre Panel", html) self.assertIn(f'https://panel.example.test{link}"', html) + self.assertIn('src="cid:coulobre-welcome-logo"', html) + plain, related = invitation.message().get_payload() + self.assertEqual(plain.get_content_type(), "text/plain") + self.assertEqual(related.get_content_type(), "multipart/related") + markup, logo = related.get_payload() + self.assertEqual(markup.get_content_type(), "text/html") + self.assertEqual(logo.get_content_type(), "image/png") + self.assertEqual(logo["Content-ID"], "") + self.assertTrue(logo.get_payload(decode=True).startswith(b"\x89PNG")) manage_url = reverse( "panel:manage_invitation", args=["customer", customer.pk] @@ -219,6 +245,16 @@ class PanelAuthenticationTests(TestCase): ) self.assertEqual(invited_browser.get(replacement).status_code, 302) + def test_customer_cannot_edit_the_welcome_email_sender(self): + self.client.force_login(self.customer) + url = reverse("panel:invitation_mail_settings") + self.assertEqual( + self.client.post( + url, {"sender_address": "other@example.test"} + ).status_code, + 403, + ) + def invitation_path(self, body): return urlsplit( next(line for line in body.splitlines() if "/welcome/" in line) diff --git a/src/coulobre/hosting/urls.py b/src/coulobre/hosting/urls.py index 932c68e..7888989 100644 --- a/src/coulobre/hosting/urls.py +++ b/src/coulobre/hosting/urls.py @@ -41,7 +41,11 @@ from .independent_website_views import ( IndependentWebsiteOperation, IndependentWebsitePhpSettings, ) -from .installation_views import FeatureConfigurationView, InstallationView +from .installation_views import ( + FeatureConfigurationView, + InstallationView, + InvitationMailSettingsView, +) from .invitations import AcceptInvitation, ManageInvitation from .mail_delivery_views import MailDeliveryView from .mail_dns_views import MailDnsCheckView, RequestMailDnsSetup @@ -296,6 +300,11 @@ urlpatterns = [ FeatureConfigurationView.as_view(), name="operator_settings", ), + path( + "settings/email/sender/", + InvitationMailSettingsView.as_view(), + name="invitation_mail_settings", + ), path("account/role/", switch_panel_role, name="switch_panel_role"), path( "account/getting-started/", diff --git a/src/coulobre/hosting/workspaces.py b/src/coulobre/hosting/workspaces.py index b602755..1ae7ce9 100644 --- a/src/coulobre/hosting/workspaces.py +++ b/src/coulobre/hosting/workspaces.py @@ -70,6 +70,7 @@ WORKSPACE_PARENT_ROUTES = { "remote_deploy": ("connected_nodes", ()), "dns_topology": ("dns_defaults", ()), "operator_settings": ("operator_settings", ("general",)), + "invitation_mail_settings": ("operator_settings", ("general",)), "http_defaults": ("http_defaults", ("apache",)), "server_updates": ("updates", ()), "changelog": ("updates", ()),