mirror of
https://github.com/wassname/flask-security.git
synced 2026-07-01 16:50:07 +08:00
Add mail context processory
This commit is contained in:
@@ -253,6 +253,9 @@ class _SecurityState(object):
|
||||
def send_login_context_processor(self, fn):
|
||||
self._add_ctx_processor('send_login', fn)
|
||||
|
||||
def mail_context_processor(self, fn):
|
||||
self._add_ctx_processor('mail', fn)
|
||||
|
||||
|
||||
class Security(object):
|
||||
"""The :class:`Security` class initializes the Flask-Security extension.
|
||||
|
||||
@@ -242,6 +242,7 @@ def send_mail(subject, recipient, template, **context):
|
||||
|
||||
mail = current_app.extensions.get('mail')
|
||||
context.setdefault('security', _security)
|
||||
context.update(_security._run_ctx_processor('mail'))
|
||||
|
||||
msg = Message(subject,
|
||||
sender=_security.email_sender,
|
||||
|
||||
Reference in New Issue
Block a user