예제 #1
0
def login():
    if current_user.is_authenticated:
        return redirect(url_for('index'))

    form = LoginForm()
    if form.validate_on_submit():
        user = UserModel.query.filter_by(email=form.email.data).first()

        login_user(user, remember=form.remember.data)
        return redirect(url_for('main'))

    return render_template('security/login_user.html', login_user_form=form)
예제 #2
0
def home():
    if current_user.is_authenticated:
        return render_template('index_authenticated.html', FLAG=FLAG)
    else:
        return render_template('index.html',
                               url_for_security=url_for_security,
                               login_form=LoginForm(next=url_for('home')))
예제 #3
0
def login():
    """View function for login view"""


    form = LoginForm()

    if form.validate_on_submit():
        login_user(form.user, remember=form.remember.data)
        after_this_request(_commit)

        if not request.json:
            return redirect(get_post_login_redirect())


    return render('login.html',
        login_user_form=form)
예제 #4
0
 def index(self):
     form = LoginForm()
     return self.render('security/login_user.html', login_user_form=form)
예제 #5
0
def home():
    return render_template('index.html',
                           url_for_security=url_for_security,
                           login_form=LoginForm(next=url_for('dashboard')))
예제 #6
0
def login_csrf():
    form = LoginForm()
    return jsonify({'csrf_token': form.csrf_token.current_token})
예제 #7
0
 def login_context():
     return {
         'url_for_security': url_for_security,
         'login_user_form': LoginForm(),
     }