]> git.ipfire.org Git - pbs.git/commitdiff
Add mail feature to password reset
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Wed, 1 Nov 2017 18:54:18 +0000 (19:54 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 1 Nov 2017 18:55:19 +0000 (18:55 +0000)
We can now send an email with an reset code.

Fixes: #10095
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/buildservice/users.py
src/templates/messages/users/password-reset.markdown [new file with mode: 0644]

index cf6c610a66ec71d6420e82f53c327f55b8da15de..918178e36506b5387fb0fb89d6698f976049273f 100644 (file)
@@ -255,7 +255,8 @@ templates_messages_jobsdir = $(templates_messagesdir)/jobs
 
 dist_templates_messages_users_DATA = \
        src/templates/messages/users/account-activation.markdown \
-       src/templates/messages/users/email-activation.markdown
+       src/templates/messages/users/email-activation.markdown \
+       src/templates/messages/users/password-reset.markdown
 
 templates_messages_usersdir = $(templates_messagesdir)/users
 
index a886b824b5e7b1eca4a0197026c166ea75f473fd..01cf4972d765f82f0743e10017cdf07054e12b31 100644 (file)
@@ -474,9 +474,8 @@ class User(base.DataObject):
                # Add a recovery code to the database and a timestamp when this code expires
                self.password_recovery_code = generate_random_string(64)
 
-               # XXX
-               # We should send an email with the activation code
-
+               # Send an email with the activation code
+               self.send_template("messages/users/password-reset", user=self)
 
        @property
        def activated(self):
diff --git a/src/templates/messages/users/password-reset.markdown b/src/templates/messages/users/password-reset.markdown
new file mode 100644 (file)
index 0000000..b4f9fdf
--- /dev/null
@@ -0,0 +1,10 @@
+Subject: {{ _("Password Reset") }}
+
+{{ _("You, or somebody else has requested a password reset for the Pakfire Build Service.") }}
+
+{{ _("To reset your password, please click on the link below:") }}
+
+  {{ baseurl }}/password-reset?code={{ user.password_recovery_code }}
+
+Sincerely,  
+-The Pakfire Build Service