Ejemplo n.º 1
0
def invite(name, h):
	if current_user.is_authenticated():
		return redirect(url_for('index'))

	if not Invite.confirm_invite(name, h):
		flash(config.messages.BAD_INVITE, category='red')
		return redirect(url_for('index'))

	register = Register(request.form)
	register._action = request.path

	if request.method == 'POST' and register.validate():
		user = User(
			username=name,
			h=bcrypt.generate_password_hash(register.password.data),
			max_load=config.AUTH_PAYLOAD
		).save()

		Invite.delete_invite(name, h)

		flash('You are now registered.')

		return redirect(url_for('login'))

	return render_template('register.html', title='You\'re Invited', form=register)
Ejemplo n.º 2
0
def register():
    My_form = Register(request.form)
    if request.method == 'POST' and My_form.validate():