Add mail feature to password reset
Commit Message
We can now send an email with an reset code.
Fixes: #10095
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
---
Makefile.am | 3 ++-
src/buildservice/users.py | 5 ++---
src/templates/messages/users/password-reset.markdown | 10 ++++++++++
3 files changed, 14 insertions(+), 4 deletions(-)
create mode 100644 src/templates/messages/users/password-reset.markdown
@@ -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
@@ -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):
new file mode 100644
@@ -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