From: Jonatan Schlag Date: Wed, 1 Nov 2017 18:54:18 +0000 (+0100) Subject: Add mail feature to password reset X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a76becd9be86ad0e505cf67bc8a0c24047c1292e;p=pbs.git Add mail feature to password reset We can now send an email with an reset code. Fixes: #10095 Signed-off-by: Jonatan Schlag Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index cf6c610a..918178e3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/src/buildservice/users.py b/src/buildservice/users.py index a886b824..01cf4972 100644 --- a/src/buildservice/users.py +++ b/src/buildservice/users.py @@ -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 index 00000000..b4f9fdfb --- /dev/null +++ b/src/templates/messages/users/password-reset.markdown @@ -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