<?php

if (!isset($loginHandler)) {
    $loginHandler = new \Bdp\Modules\LimitLoginAttempts\Controllers\LoginHandler();
}

add_action('wp_login_failed', [$loginHandler, 'onFailedLogin']);
add_filter('wp_authenticate_user', [$loginHandler, 'onSuccessFullLogin'], 99999, 2);
add_filter( 'admin_enqueue_scripts', 'enqueue_custom_password_js',10 );

add_action('admin_init', 'admin_init');

if (get_option('kompass_cookies', false)) {
    $loginHandler->handleCookies();
    add_action('auth_cookie_bad_username', [$loginHandler, 'checkFailedCookies']);
    add_action('auth_cookie_valid', [$loginHandler, 'onValidCookie'], 10, 2);
}

if (isset($_POST['save_kompass_balist_list_type'])) {
    updateBlockOrAllowList($_POST);
}


