Пример #1
0
def index():
    if user_permission.can() or pending_permission.can():
        return render_template('layout.html')
    elif new_permission.can():
        return redirect(url_for('user.access'))

    return redirect(url_for('user.login'))
Пример #2
0
def access():
    if pending_permission.can():
        flash('Already requested')
        return redirect(url_for('user.index'))
    elif new_permission.can():
        form = UserAccessForm()
        if form.validate_on_submit():
            success = set_request(form)
            if success:
                flash('Request Success!')
            else:
                flash('Request Failed!')
            return redirect(url_for('user.index'))
        else:
            return render_template('GenericForm.html', form=form)
    else:
        return redirect(url_for('user.index'))