allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [02/14] git commit: [#6783] ticket:463 sending email with link to password recovery
Date Thu, 07 Nov 2013 21:07:15 GMT
[#6783] ticket:463 sending email with link to password recovery


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/5c328f5a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/5c328f5a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/5c328f5a

Branch: refs/heads/master
Commit: 5c328f5ad07068b628349662198b9ed6ed8bfe95
Parents: 4bef681
Author: coldmind <sokandpal@yandex.ru>
Authored: Fri Oct 25 17:24:31 2013 +0300
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Thu Nov 7 21:05:00 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/auth.py               | 17 +++++++++++++++++
 Allura/allura/templates/forgotten_password.html |  2 +-
 2 files changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5c328f5a/Allura/allura/controllers/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index 6d9295a..9ca5ff2 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -182,6 +182,23 @@ class AuthController(BaseController):
         user_record = M.User.query.find({'preferences.email_address': email}).first()
         hash = h.nonce(42)
         user_record.set_tool_data('AuthPasswordReset', hash=hash)
+
+        log.info('Sending password recovery link to %s', email)
+        text = '''
+To reset your password on %s, please visit the following URL:
+
+%s/auth/forgotten_password/%s
+
+''' % (config['site_name'], config['base_url'], hash)
+
+        allura.tasks.mail_tasks.sendmail.post(
+            destinations=[email],
+            fromaddr=config['forgemail.return_path'],
+            reply_to='',
+            subject='Password recovery',
+            message_id=h.gen_message_id(),
+            text=text)
+
         flash('Email with instructions has been sent.')
         redirect('/')
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5c328f5a/Allura/allura/templates/forgotten_password.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/forgotten_password.html b/Allura/allura/templates/forgotten_password.html
index dbd4f19..56959c2 100644
--- a/Allura/allura/templates/forgotten_password.html
+++ b/Allura/allura/templates/forgotten_password.html
@@ -26,7 +26,7 @@
 {% block content %}
 <div class="grid-20">
   {% if c.forgotten_password_form %}
-    {{ c.forgotten_password_form.display(action="../password_recovery_hash") }}
+    {{ c.forgotten_password_form.display(action="./password_recovery_hash") }}
   {% endif %}
 
   {% if c.recover_password_change_form %}


Mime
View raw message