def create(): """ Page to create a new project account """ form = CreateForm(request.form) if form.validate_on_submit(): # On submit, grab form information project_name = form.project_name.data email = form.email.data password = form.password.data hashed_password = generate_password_hash(password) description = form.description.data # Create the account db = DB() resp = db.create(project_name, password, hashed_password, description=description, email=email) if resp['status']: flash('Project successfully created!') return redirect( url_for('admin_home', admin_id=g.admin['project_id'])) else: flash(resp['message']) return render_template('create.html', form=form)
def setup(): """ Called on a new install to setup an admin account """ form = SetupForm(request.form) if form.validate_on_submit(): # On submit, grab form information project_name = form.project_name.data password = form.password.data hashed_password = generate_password_hash(password) # Create the account db = DB() resp = db.create(project_name, password, hashed_password, admin=True) if resp['status']: flash('Project successfully created!') return redirect(url_for('index')) else: flash(resp['message']) return render_template('setup.html', form=form)
cont = True email = [] while cont: inut_email = raw_input('Email: ') email.append(inut_email) add_more = raw_input('Add Another Email [y/n]: ') if add_more is not 'y': cont = False description = raw_input('Description: ') resp = db.create(project_name, password, hashed_password, description=description, email=email) print json.dumps(resp, indent=1) elif method == 'auth': """ python __main__.py db auth project_name password """ project_name = sys.argv[3] password = sys.argv[4] resp = db.auth(project_name, password) print json.dumps(resp, indent=1) elif method == 'get_project_list': """
password = raw_input('Password: '******'Email: ') email.append(inut_email) add_more = raw_input('Add Another Email [y/n]: ') if add_more is not 'y': cont = False description = raw_input('Description: ') resp = db.create(project_name, password, hashed_password, description=description, email=email) print json.dumps(resp, indent=1) elif method == 'auth': """ python __main__.py db auth project_name password """ project_name = sys.argv[3] password = sys.argv[4] resp = db.auth(project_name, password) print json.dumps(resp, indent=1) elif method == 'get_project_list': """ python __main__.py db get_project_list """