]> git.ipfire.org Git - ipfire.org.git/commitdiff
accounts: Add a probe handler to people can reset their bounces
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 22 Jan 2026 16:17:03 +0000 (16:17 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 22 Jan 2026 16:17:03 +0000 (16:17 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/backend/accounts.py
src/templates/accounts/messages/probe.txt
src/templates/users/probe.html [new file with mode: 0644]
src/web/__init__.py
src/web/users.py

index 7d2d5eaa36d6e72f5e3d2b75095213b76f1f9834..88a42447ad614052db3f10e33b5d136c4eaa8c26 100644 (file)
@@ -370,6 +370,7 @@ templates_users_DATA = \
        src/templates/users/edit.html \
        src/templates/users/index.html \
        src/templates/users/passwd.html \
+       src/templates/users/probe.html \
        src/templates/users/recently-joined.html \
        src/templates/users/show.html \
        src/templates/users/subscribe.html \
index ebe6fb4f5db95c29d6f6eea11683bbce6efe9901..cc48f686abbe7d3c2555d2523a7074e80d4fdbcc 100644 (file)
@@ -1790,6 +1790,31 @@ class Account(LDAPObject):
 
                return res.sent_at if res else None
 
+       def probe_received(self):
+               """
+                       Called when the user has clicked the link on the probe message
+               """
+               log.info("Probe response received from %s" % self)
+
+               # Delete all bounces
+               self.db.execute("""
+                       DELETE FROM
+                               account_bounces
+                       WHERE
+                               uid = %s
+                       """, self.uid,
+               )
+
+               # Delete the last probe
+               self.db.execute("""
+                       DELETE FROM
+                               account_probes
+                       WHERE
+                               uid = %s
+                       """, self.uid,
+               )
+
+
 class Groups(Object):
        hidden_groups = (
                "cn=LDAP Read Only,ou=Group,dc=ipfire,dc=org",
index fe2e580ab387b6a6bea89ffb33521c5cea8bd6e9..34ab5dbc5d55a8c923497f393b4b08caab5ebf10 100644 (file)
@@ -12,11 +12,11 @@ to make sure you're still getting our updates if you want them!
 
 Click here to confirm you still want to hear from us:
 
-  [VERIFY_LINK]
+  https://www.ipfire.org/probe
 
 Or update your email address in your settings:
 
-  [SETTINGS_LINK]
+  https://www.ipfire.org/users/{{ account.uid }}/edit
 
 No worries if you'd rather not receive emails - just ignore this message
 and we'll stop trying and close your account.
diff --git a/src/templates/users/probe.html b/src/templates/users/probe.html
new file mode 100644 (file)
index 0000000..2f300e1
--- /dev/null
@@ -0,0 +1,19 @@
+{% extends "../base.html" %}
+
+{% block title %}{{ _("Thank You") }}{% end block %}
+
+{% block container %}
+       <div class="columns is-centered">
+               <div class="column is-one-third-desktop">
+                       <div class="notification is-success my-auto has-text-centered">
+                               <div class="block">
+                                       <span class="fa-solid fa-check fa-5x my-4"></span>
+                               </div>
+
+                               <p>
+                                       {{ _("You have confirmed your email address and will continue to receive email from us.") }}
+                               </p>
+                       </div>
+               </div>
+       </div>
+{% end block %}
index 7db26e64ef877d053067e869d4fd313e55c93187..d41bb98a7623d3c07802a759263783f3da571525 100644 (file)
@@ -247,6 +247,9 @@ class Application(tornado.web.Application):
                        (r"/subscribe", users.SubscribeHandler),
                        (r"/unsubscribe", users.UnsubscribeHandler),
 
+                       # Probe responses
+                       (r"/probe", users.ProbeHandler),
+
                        # VoIP
                        (r"/voip", voip.IndexHandler),
 
index 79d51db25c1f8059d295c6bc529b570aa7235aff..0b347e612d439efceee8260ff58da85c44cd66d0 100644 (file)
@@ -387,6 +387,15 @@ class UnsubscribeHandler(base.BaseHandler):
                self.render("users/unsubscribed.html")
 
 
+class ProbeHandler(base.BaseHandler):
+       @tornado.web.authenticated
+       def get(self):
+               with self.db.transaction():
+                       self.current_user.probe_received()
+
+               self.render("users/probe.html")
+
+
 class ListModule(ui_modules.UIModule):
        def render(self, accounts, show_created_at=False):
                return self.render_string("users/modules/list.html", accounts=accounts,