mirror of
https://github.com/wassname/flask-security.git
synced 2026-09-10 12:01:01 +08:00
Update send_mail api and add welcome email for user registration. Also add security state to template context for emails for more complex template rendering.
This commit is contained in:
@@ -230,7 +230,7 @@ def get_within_delta(key, app=None):
|
||||
return timedelta(**{values[1]: int(values[0])})
|
||||
|
||||
|
||||
def send_mail(subject, recipient, template, context=None):
|
||||
def send_mail(subject, recipient, template, **context):
|
||||
"""Send an email via the Flask-Mail extension.
|
||||
|
||||
:param subject: Email subject
|
||||
@@ -241,7 +241,7 @@ def send_mail(subject, recipient, template, context=None):
|
||||
from flask.ext.mail import Message
|
||||
|
||||
mail = current_app.extensions.get('mail')
|
||||
context = context or {}
|
||||
context.setdefault('security', _security)
|
||||
|
||||
msg = Message(subject,
|
||||
sender=_security.email_sender,
|
||||
|
||||
Reference in New Issue
Block a user