From 805497b6a5f6a0933d0fb3809c4b4aa0847bfc6f Mon Sep 17 00:00:00 2001
From: Helge Jung <hej@c3pb.de>
Date: Sun, 3 Nov 2024 11:55:55 +0100
Subject: [PATCH] core: use hub_absolute for account activation and password
 reset mails

---
 src/core/templates/registration/core_password_reset_email.html | 3 ++-
 src/core/templates/registration/registration_email.html        | 3 ++-
 src/core/views/auth.py                                         | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/core/templates/registration/core_password_reset_email.html b/src/core/templates/registration/core_password_reset_email.html
index 00ee6fc7a..d0f63c7fd 100644
--- a/src/core/templates/registration/core_password_reset_email.html
+++ b/src/core/templates/registration/core_password_reset_email.html
@@ -1,4 +1,5 @@
 {% load i18n %}
+{% load hub_absolute %}
 {% autoescape off %}
   {% trans "Hello" %} {{ user.get_full_name|default:user.username }},
   {% blocktranslate with site_name_safe=site_name|safe %}
@@ -6,7 +7,7 @@ You're receiving this email because you requested a password reset for your user
 Please use the following link and choose a new password:
 {% endblocktranslate %}
   {% block reset_link %}
-    {{ protocol }}://{{ domain }}{% url reset_url uidb64=uid token=token %}
+    {% hub_absolute 'plainui:password_reset_confirm' uidb64=uid token=token %}
   {% endblock reset_link %}
   {% blocktranslate %}
 Your username, in case you’ve forgotten: {{ user.username}}
diff --git a/src/core/templates/registration/registration_email.html b/src/core/templates/registration/registration_email.html
index 3e47baa9e..c08a61a9f 100644
--- a/src/core/templates/registration/registration_email.html
+++ b/src/core/templates/registration/registration_email.html
@@ -1,11 +1,12 @@
 {% load i18n %}
+{% load hub_absolute %}
 {% autoescape off %}
   {% trans "Hello" %} {{ user.get_full_name|default:user.username }},
   {% blocktranslate %}
 You're receiving this email because you requested to create an account at "{{ site_name }}".
 To complete the registration please use the following link:
 {% endblocktranslate %}
-  {{ protocol }}://{{ domain }}{% url activation_url uid_b64=uid channel_id=cid token=token %}
+  {% hub_absolute activation_url uid_b64=uid channel_id=cid token=token %}
 
   {% blocktranslate %}
 If you did not register for an account, you may ignore this message.
diff --git a/src/core/views/auth.py b/src/core/views/auth.py
index 897863c35..a5ac41e65 100644
--- a/src/core/views/auth.py
+++ b/src/core/views/auth.py
@@ -79,7 +79,7 @@ class BaseRegistrationView(FormView):
     html_email_template_name = None
     subject_template_name = 'registration/registration_subject.txt'
     success_url = reverse_lazy('signup_done')
-    activation_url = reverse_lazy('signup_activate')
+    activation_url = 'signup_activate'
     template_name = 'registration/registration_form.html'
     title = _('Registration')
     token_generator = channel_activation_token
-- 
GitLab