def login(): if current_user.is_authenticated(): return redirect(url_for('schools.home')) form = LoginForm(username=request.args.get('username', None), next=request.args.get('next', None)) if form.validate_on_submit(): user, authenticated = authenticate_user(form.username.data, form.password.data) if user and authenticated: remember = request.form.get('remember') == 'y' if login_user(user, remember=remember): flash( Markup( "<span class=\"glyphicon glyphicon-ok\"></span> Logged in" ), 'success') # redirects to specified page OR the homepage for the user's school return redirect(form.next.data or url_for('schools.home')) else: flash( Markup( '<span class="glyphicon glyphicon-exclamation-sign"></span> Sorry, invalid login' ), 'danger') if 'login?interested_user=anon' in request.url: flash( Markup( "<span class=\"glyphicon glyphicon-info-sign\"></span> You have to login before attending a class." ), "info") return render_template('auth/login.html', title='login', form=form)
def login(): if current_user.is_authenticated(): return redirect(url_for('proposals.make')) form = LoginForm(username=request.args.get('username', None), next=request.args.get('next', None)) if form.validate_on_submit(): user, authenticated = authenticate_user(form.username.data, form.password.data) if user and authenticated: remember = request.form.get('remember') == 'y' if login_user(user, remember=remember): flash(_("Logged in"), 'success') # redirects to specified page OR the homepage for the user's school return redirect(form.next.data or url_for_school('schools.home', user_school=True)) else: flash(_('Sorry, invalid login'), 'error') return render_template('auth/login.html', title='login', form=form)
def login(): if current_user.is_authenticated(): return redirect(url_for('proposals.make')) form = LoginForm(username=request.args.get('username', None), next=request.args.get('next', None)) if form.validate_on_submit(): user, authenticated = authenticate_user(form.username.data, form.password.data) if user and authenticated: remember = request.form.get('remember') == 'y' if login_user(user, remember=remember): flash(_("Logged in"), 'success') # redirects to specified page OR the homepage for the user's school return redirect( form.next.data or url_for_school('schools.home', user_school=True)) else: flash(_('Sorry, invalid login'), 'error') return render_template('auth/login.html', title='login', form=form)
def login(): if current_user.is_authenticated(): return redirect(url_for('schools.home')) form = LoginForm(username=request.args.get('username', None), next=request.args.get('next', None)) if form.validate_on_submit(): user, authenticated = authenticate_user(form.username.data, form.password.data) if user and authenticated: remember = request.form.get('remember') == 'y' if login_user(user, remember=remember): flash(Markup("<span class=\"glyphicon glyphicon-ok\"></span> Logged in"), 'success') # redirects to specified page OR the homepage for the user's school return redirect(form.next.data or url_for('schools.home')) else: flash(Markup('<span class="glyphicon glyphicon-exclamation-sign"></span> Sorry, invalid login'), 'danger') if 'login?interested_user=anon' in request.url: flash(Markup("<span class=\"glyphicon glyphicon-info-sign\"></span> You have to login before attending a class."), "info") return render_template('auth/login.html', title='login', form=form)