user.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:Albireo 作者: lordfriend 项目源码 文件源码
def send_confirm_email(self):
        """
        Send an confirm email to user. contains a link to confirm the email
        confirm link is not provide by this app, a client must implement this endpoint to complete the confirmation.
        """
        from server import app, mail
        token = self.generate_confirm_email_token()
        confirm_url = '{0}://{1}/email-confirm?token={2}'.format(app.config['SITE_PROTOCOL'],
                                                                 app.config['SITE_HOST'],
                                                                 token)
        subject = '[{0}] Email Address Confirmation'.format(app.config['SITE_NAME'])
        email_content = render_template('email-confirm.html', info={
            'confirm_title': subject,
            'confirm_url': confirm_url,
            'site_name': app.config['SITE_NAME'],
            'user_name': self.name
        })
        msg = Message(subject, recipients=[self.email], html=email_content)
        try:
            mail.send(msg)
        except SMTPAuthenticationError:
            raise ServerError('SMTP authentication failed', 500)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号