def offer_password_reset(user): token = user.get_token() token_url = utils.absolute_url('/pwreset/%s/%s' % (urllib.quote(user.email), token)) message = flask.render_template('pwreset.eml', token_url=token_url, user=user, ip=flask.request.remote_addr, config=app.config) subject = '%s Password Reset' % app.config.get('TITLE') try: mail.send(message, subject, user.email, to_name=user.nick) except mail.MailFailure: raise errors.ServerError('Could not send mail.')
def offer_password_reset(user): token = user.get_token() token_url = utils.absolute_url('/pwreset/%s/%s' % (urllib.quote(user.email), token)) message = flask.render_template('pwreset.eml', token_url=token_url, user=user, ip=flask.request.remote_addr, config=app.config) subject = '%s Password Reset' % app.config.get('TITLE', 'CTF') try: mail.send(message, subject, user.email, to_name=user.nick) except mail.MailFailure: raise errors.ServerError('Could not send mail.')