def _do_on_login(sender, user, **extra):
"""Notify the user of a new login.
This is only done if the ``notify_login`` attribute is set to ``True``.
"""
if user.notify_login:
notification = Message(
'akamatsu - New session started',
recipients=[user.email],
body=render_template('mail/login.txt', user=user),
html=render_template('mail/login.html', user=user)
)
mail.send(notification)
评论列表
文章目录