def notify_billing_changed(sender, user_id): user = security.datastore.find_user(id=user_id) current_app.logger.debug("Billing data changed for %s", user.email) if user.customer.organizer_ready: role = security.datastore.find_role(current_app.config['ADMIN_ROLE']) recipients = map(lambda u: u.email, role.users) send_email(_('Billing data changed'), recipients, 'billing_data_changed', user=user)
def request_reset(): if request.method == 'POST' and request.form.get('email'): user = User.query.filter_by(email=request.form['email']).first_or_404() token = user.create_token() # Create the message send_email(to=request.form['email'], subject="You've requested a password reset", body=render_template("email_reset.html", token=token)) flash("We sent you an email with the special link to restore " "your password", 'success') return redirect(url_for('.request_reset')) return render_template('password_reset_request.html')
def user_created(instance): message_body = render_template('email_registered.html', token=instance.create_token()) send_email(to=instance.email, body=message_body, subject='Please activate your account') return 'user created'