Exemple #1
0
def signin():

    title = 'Sign in'

    if current_user.is_authenticated:
        redirect(url_for('auth.index'))

    form = RegistrationForm()

    if form.validate_on_submit():
        if form.email_validate() or form.username_validate():
            pass
        else:
            user = User(username=form.username.data, email=form.email.data)
            user.set_password(form.password_first.data)
            db.session.add(user)
            db.session.commit()
            return redirect(url_for('auth.login'))
    return render_template('auth/signin.html', title=title, form=form)