Ejemplo n.º 1
0
def landing_view():
    if g.permission > 0:
        return redirect('/cabinet')
    form = LoginForm()
    if request.method == 'POST':
        if form.validate_on_submit() and User.verify_passwd(
                form.login.data, form.passwd.data):
            User.log_in(form.login.data)
            return redirect('/cabinet')
        else:
            flash(INVALID_USER, 'text-danger')
            return redirect('/')
    return render_template('landing.html', title='Sign in', form=form)
Ejemplo n.º 2
0
def create_profile_view(login):
    form = ProfileForm()
    if form.validate_on_submit():
        User.update_access_status(login, 2)
        User.create_profile(User.get_user_id(login), form.gender.data,
                            form.preferences.data, form.biography.data,
                            form.interests.data, form.city.data,
                            form.show_location.data)
        User.log_in(login)
        User.create_user_folder(session['login'], session['id'])
        return redirect(url_for('routes.add_photo_view'))
    if User.accept_confirmation_email(login):
        User.update_access_status(login, 1)
        return render_template('create_profile.html', form=form)
    else:
        flash(ACCESS_DENIED, 'text-danger')
        return redirect('/')