def seed_admin(admin_file): try: with open(admin_file, 'r') as file: admins = yaml.load(file) for admin in admins: User.create(username=admin['username'], password=admin['password'], is_admin=True, active=True) except IntegrityError: print("Some of those credentials already exist.") exit(0)
def register(): form = RegisterForm(request.form, csrf_enabled=False) if form.validate_on_submit(): game = create_game() User.create(username=form.username.data, password=form.password.data, active=True, game_id=game.id) flash("Thank you for registering. You can now log in.", 'success') return redirect(url_for('public.home')) else: flash_errors(form) return render_template('public/register.html', form=form)