예제 #1
0
def login():
    """ This is the login route and processing of information
    """
    # Calls the new function in order to refresh the auth_source list
    login_form = forms.LoginForm.new()

    if current_user.is_authenticated:
        return redirect(url_for('index'))
    else:
        if request.method == 'GET':
            return render_template('login.html', title='PostMaster Login', loginForm=login_form)
        elif login_form.validate_on_submit():
            username = login_form.admin.username
            login_user(login_form.admin, remember=False)
            clear_lockout_fields_on_user(username)
            json_logger(
                'auth', username,
                'The administrator "{0}" logged in successfully'.format(
                    username))
            return redirect(request.args.get('next') or url_for(
                'index'))
        else:
            wtforms_errors = get_wtforms_errors(login_form)
            if wtforms_errors:
                flash(wtforms_errors)

    return redirect(url_for('login'))
예제 #2
0
def login():
    """ This is the login route and processing of information
    """
    # Calls the new function in order to refresh the auth_source list
    login_form = forms.LoginForm.new()

    if current_user.is_authenticated:
        return redirect(url_for('index'))
    else:
        if request.method == 'GET':
            return render_template('login.html',
                                   title='PostMaster Login',
                                   loginForm=login_form)
        elif login_form.validate_on_submit():
            username = login_form.admin.username
            login_user(login_form.admin, remember=False)
            clear_lockout_fields_on_user(username)
            json_logger(
                'auth', username,
                'The administrator "{0}" logged in successfully'.format(
                    username))
            return redirect(request.args.get('next') or url_for('index'))
        else:
            wtforms_errors = get_wtforms_errors(login_form)
            if wtforms_errors:
                flash(wtforms_errors)

    return redirect(url_for('login'))
예제 #3
0
def unlockadmin(username):
    """Unlocks a locked out administrator"""
    clear_lockout_fields_on_user(username)
예제 #4
0
def unlockadmin(username):
    """Unlocks a locked out administrator"""
    clear_lockout_fields_on_user(username)
예제 #5
0
def unlock_admin(admin_id):
    """ Unlocks an admin by ID in Admins, and returns HTTP 200 on success
    """
    admin = Admins.query.get_or_404(admin_id)
    clear_lockout_fields_on_user(admin.username)
    return {}, 200
예제 #6
0
def unlock_admin(admin_id):
    """ Unlocks an admin by ID in Admins, and returns HTTP 200 on success
    """
    admin = Admins.query.get_or_404(admin_id)
    clear_lockout_fields_on_user(admin.username)
    return {}, 200