Skip to content

Commit 26609b5

Browse files
committed
v0.19.1: Fix email links missing site domain
- Make _base_url() fall back to CSRF_TRUSTED_ORIGINS[0] when FORMS_WORKFLOWS_BASE_URL and SITE_BASE_URL are not configured
1 parent b2a38f4 commit 26609b5

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

django_forms_workflows/tasks.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,22 @@ def _wrapper(*args, **kwargs):
4646

4747

4848
def _base_url() -> str:
49-
return (
50-
getattr(settings, "FORMS_WORKFLOWS_BASE_URL", None)
51-
or getattr(settings, "SITE_BASE_URL", None)
52-
or ""
49+
"""Return the base URL (scheme + domain) for building absolute links in emails.
50+
51+
Checks, in order:
52+
1. ``settings.FORMS_WORKFLOWS_BASE_URL``
53+
2. ``settings.SITE_BASE_URL``
54+
3. First entry in ``settings.CSRF_TRUSTED_ORIGINS``
55+
"""
56+
url = getattr(settings, "FORMS_WORKFLOWS_BASE_URL", None) or getattr(
57+
settings, "SITE_BASE_URL", None
5358
)
59+
if url:
60+
return url
61+
origins = getattr(settings, "CSRF_TRUSTED_ORIGINS", None)
62+
if origins:
63+
return origins[0]
64+
return ""
5465

5566

5667
def _abs(url_path: str) -> str:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "django-forms-workflows"
3-
version = "0.19.0"
3+
version = "0.19.1"
44
description = "Enterprise-grade, database-driven form builder with approval workflows and external data integration"
55
license = "LGPL-3.0-only"
66
readme = "README.md"

0 commit comments

Comments
 (0)