allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [3/3] git commit: [#7410] move email to a template
Date Tue, 03 Jun 2014 14:56:57 GMT
[#7410] move email to a template


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

Branch: refs/heads/master
Commit: 5e94ea5afcc745aa42de953f47f99415522edb2f
Parents: b2fb5f1
Author: Dave Brondsema <dbrondsema@slashdotmedia.com>
Authored: Tue Jun 3 14:56:30 2014 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Tue Jun 3 14:56:30 2014 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/auth.py               | 13 ++++-------
 .../allura/templates/mail/forgot_password.txt   | 24 ++++++++++++++++++++
 2 files changed, 29 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/5e94ea5a/Allura/allura/controllers/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index 7676191..c25e33e 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -180,14 +180,11 @@ class AuthController(BaseController):
 
         log.info('Sending password recovery link to %s', email)
         subject = '%s Password recovery' % config['site_name']
-        text = '''
-Your username is %s
-
-To reset your password on %s, please visit the following URL:
-
-%s/auth/forgotten_password/%s
-
-''' % (user_record.username, config['site_name'], config['base_url'], hash)
+        text = g.jinja2_env.get_template('allura:templates/mail/forgot_password.txt').render(dict(
+            user=user_record,
+            config=config,
+            hash=hash,
+        ))
 
         allura.tasks.mail_tasks.sendmail.post(
             destinations=[email],

http://git-wip-us.apache.org/repos/asf/allura/blob/5e94ea5a/Allura/allura/templates/mail/forgot_password.txt
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/mail/forgot_password.txt b/Allura/allura/templates/mail/forgot_password.txt
new file mode 100644
index 0000000..5f5f71a
--- /dev/null
+++ b/Allura/allura/templates/mail/forgot_password.txt
@@ -0,0 +1,24 @@
+{#
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+-#}
+
+Your username is {{ user.username }}
+
+To reset your password on {{ config['site_name'] }}, please visit the following URL:
+
+{{ config['base_url'] }}/auth/forgotten_password/{{hash}}


Mime
View raw message