Commits

ana-balica committed 0e122fc

templates for email based functions

Comments (0)

Files changed (3)

MoinMoin/templates/mail/account_verification.txt

+{{ _("""\
+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) }}

MoinMoin/templates/mail/password_recovery.txt

+{{ _("""\
+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) }}
 
 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__)
         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
         """ 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")
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.