Mercurial > moin-2.0
changeset 2104:0e122fcb96ca
templates for email based functions
| author | Ana Balica <ana.balica@gmail.com> |
|---|---|
| date | Thu, 25 Apr 2013 22:44:32 +0300 |
| parents | 7c00da767896 |
| children | 979c2ee641ac 054749699f8a |
| files | MoinMoin/templates/mail/account_verification.txt MoinMoin/templates/mail/password_recovery.txt MoinMoin/user.py |
| diffstat | 3 files changed, 25 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MoinMoin/templates/mail/account_verification.txt Thu Apr 25 22:44:32 2013 +0300 @@ -0,0 +1,10 @@ +{{ _("""\ +Somebody has created an account with this email address. + +Please use the link below to verify your email address: + +%(link)s + +If you didn't create this account, please ignore this email. + +""", link=link) }} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MoinMoin/templates/mail/password_recovery.txt Thu Apr 25 22:44:32 2013 +0300 @@ -0,0 +1,10 @@ +{{ _("""\ +Somebody has requested to email you a password recovery link. + +Please use the link below to change your password to a known value: + +%(link)s + +If you didn't forget your password, please ignore this email. + +""", link=link) }} \ No newline at end of file
--- a/MoinMoin/user.py Thu Apr 11 21:21:30 2013 +0200 +++ b/MoinMoin/user.py Thu Apr 25 22:44:32 2013 +0300 @@ -29,7 +29,7 @@ from flask import current_app as app from flask import g as flaskg -from flask import session, request, url_for +from flask import session, request, url_for, render_template from MoinMoin import log logging = log.getLogger(__name__) @@ -770,18 +770,9 @@ if subject is None: subject = _('[%(sitename)s] Your wiki password recovery link', sitename='%(sitename)s') subject = subject % dict(sitename=self._cfg.sitename or "Wiki") - if text is None: - text = _("""\ -Somebody has requested to email you a password recovery link. - -Please use the link below to change your password to a known value: - -%(link)s - -If you didn't forget your password, please ignore this email. -""", link='%(link)s') - text = text % dict(link=url_for('frontend.recoverpass', username=self.name0, token=token, _external=True)) + link = url_for('frontend.recoverpass', username=self.name0, token=token, _external=True) + text = render_template('mail/password_recovery.txt', link=link) mailok, msg = sendmail.sendmail(subject, text, to=[self.email], mail_from=self._cfg.mail_from) return mailok, msg @@ -790,16 +781,8 @@ """ Mail a user a link to verify his email address. """ token = self.generate_recovery_token() - text = _("""\ -Somebody has created an account with this email address. - -Please use the link below to verify your email address: - -%(link)s - -If you didn't create this account, please ignore this email. - -""", link=url_for('frontend.verifyemail', username=self.name0, token=token, _external=True)) + link = url_for('frontend.verifyemail', username=self.name0, token=token, _external=True) + text = render_template('mail/account_verification.txt', link=link) subject = _('[%(sitename)s] Please verify your email address', sitename=self._cfg.sitename or "Wiki")
