Beispiel #1
0
def register():
    form = RegistrationForm()
    if form.validate_on_submit():
        user = User(email=form.email.data,username=form.username.data,password=form.password.data)
        db.session.add(user)
        db.session.commit()
        flash('Thanks for registration')
        return redirect(url_for('users.login'))
    return render_template('register.html',form=form)
Beispiel #2
0
def register():
    """Registers user with data from RegistrationForm"""
    form = RegistrationForm()

    if form.validate_on_submit():
        user = User(email=form.email.data,
                    username=form.username.data,
                    password=form.password.data)
        db.session.add(user)
        db.session.commit()
        flash('You have succesfully registered!', 'success')
        return redirect(url_for("users.login"))
    return render_template("register.html", form=form)
Beispiel #3
0
def register():
    form = RegistrationForm()

    if form.validate_on_submit():
        ## create User Object
        user = User(email=form.email.data,
                    username=form.username.data,
                    password=form.password.data)

        db.session.add(user)
        db.session.commit()
        flash("Thanks for registering with us!")

        ## once registered, redirect to login
        return redirect(url_for("users.login"))

    return render_template("register.html", form=form)