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)
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')))
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)
def index(self): form = LoginForm() return self.render('security/login_user.html', login_user_form=form)
def home(): return render_template('index.html', url_for_security=url_for_security, login_form=LoginForm(next=url_for('dashboard')))
def login_csrf(): form = LoginForm() return jsonify({'csrf_token': form.csrf_token.current_token})
def login_context(): return { 'url_for_security': url_for_security, 'login_user_form': LoginForm(), }