Exemplo n.º 1
0
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)
Exemplo n.º 2
0
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)
Exemplo n.º 3
0
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)
Exemplo n.º 4
0
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)
Exemplo n.º 5
0
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)
Exemplo n.º 6
0
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)