def reauth(): form = ReauthForm(next=request.args.get("next")) if request.method == "POST": user, authenticated = User.authenticate(current_user.name, form.password.data) if user and authenticated: confirm_login() current_app.logger.debug("reauth: %s" % session["_fresh"]) flash(_("Reauthenticated."), "success") return redirect("/change_password") flash(_("Password is wrong."), "error") return render_template("frontend/reauth.html", form=form)
def reauth(): form = ReauthForm(next=request.args.get('next')) if request.method == 'POST': user, authenticated = User.authenticate(current_user.name, form.password.data) if user and authenticated: confirm_login() current_app.logger.debug('reauth: %s' % session['_fresh']) flash(_('Reauthenticated.'), 'success') return redirect('/change_password') flash(_('Password is wrong.'), 'error') return render_template('frontend/reauth.html', form=form)
def login(): if current_user.is_authenticated: return redirect(url_for("user.index")) form = LoginForm(login=request.args.get("login", None), next=request.args.get("next", None)) if form.validate_on_submit(): user, authenticated = User.authenticate(form.login.data, form.password.data) if user and authenticated: remember = request.form.get("remember") == "y" if login_user(user, remember=remember): flash(_("Logged in"), "success") return redirect(form.next.data or url_for("user.index")) else: flash(_("Sorry, invalid login"), "error") return render_template("frontend/login.html", form=form)
def login(): if current_user.is_authenticated(): return redirect(url_for('user.index')) form = LoginForm(login=request.args.get('login', None), next=request.args.get('next', None)) if form.validate_on_submit(): user, authenticated = User.authenticate(form.login.data, form.password.data) if user and authenticated: remember = request.form.get('remember') == 'y' if login_user(user, remember=remember): flash(_("Logged in"), 'success') return redirect(form.next.data or url_for('user.index')) else: flash(_('Sorry, invalid login'), 'error') return render_template('frontend/login.html', form=form)
def login(): if current_user.is_authenticated: return redirect(url_for('user.index')) form = LoginForm(login=request.args.get('login', None), next=request.args.get('next', None)) if form.validate_on_submit(): user, authenticated = User.authenticate(form.login.data, form.password.data) if user and authenticated: remember = request.form.get('remember') == 'y' if login_user(user, remember=remember): flash(_("Logged in"), 'success') return redirect(form.next.data or url_for('user.index')) else: flash(_('Sorry, invalid login'), 'error') return render_template('frontend/login.html', form=form)