fdd43e2490
Before this change, we'd filter in the UI but calls to the API could allow robots accounts where we only expect real users
27 lines
683 B
Python
27 lines
683 B
Python
from app import app
|
|
|
|
from util.useremails import send_confirmation_email
|
|
|
|
from data import model
|
|
|
|
import argparse
|
|
|
|
from flask import Flask, current_app
|
|
from flask_mail import Mail
|
|
|
|
def sendConfirmation(username):
|
|
user = model.get_nonrobot_user(username)
|
|
if not user:
|
|
print 'No user found'
|
|
return
|
|
|
|
|
|
with app.app_context():
|
|
code = model.create_confirm_email_code(user)
|
|
send_confirmation_email(user.username, user.email, code.code)
|
|
print 'Email sent to %s' % (user.email)
|
|
|
|
parser = argparse.ArgumentParser(description='Sends a confirmation email')
|
|
parser.add_argument('username', help='The username')
|
|
args = parser.parse_args()
|
|
sendConfirmation(args.username)
|