<s> from flask import render_template , abort , redirect , Blueprint , jsonify , request <EOL> from flask_wtf import Form <EOL> from flask . ext . security . utils import encrypt_password <EOL> from wtforms import StringField , PasswordField <EOL> from wtforms . validators import DataRequired , Email , EqualTo <EOL> from . auth import user_datastore <EOL> setup = Blueprint ( "<STR_LIT>" , __name__ , template_folder = "<STR_LIT>" ) <EOL> def _has_users ( ) : <EOL> return user_datastore . user_model . query . count ( ) > <NUM_LIT:0> <EOL> @ setup . route ( "<STR_LIT>" , methods = [ '<STR_LIT:POST>' ] ) <EOL> def setup_submit ( ) : <EOL> if _has_users ( ) : <EOL> return "<STR_LIT>" , <NUM_LIT> <EOL> data = request . json <EOL> user_datastore . create_user ( email = data [ '<STR_LIT:email>' ] , password = encrypt_password ( data [ '<STR_LIT:password>' ] ) ) <EOL> user_datastore . db . session . commit ( ) <EOL> return "<STR_LIT>" <EOL> @ setup . route ( "<STR_LIT>" ) <EOL> def has_users ( ) : <EOL> return jsonify ( { "<STR_LIT>" : _has_users ( ) } ) </s>
