=== Login Delay Shield === Contributors: michael.damoiseau Donate link: http://damoiseau.me/ Tags: security,login,brute-force,lockout,xmlrpc,authentication,anti-spam,password-protection Requires PHP: 7.4 Requires at least: 3.5.1 Tested up to: 6.9 Version: 2.2.3 Stable tag: 2.2.3 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Login Delay Shield slows down brute-force attacks by adding a configurable delay to failed login attempts while keeping successful logins instant. == Description == WordPress is one of the most widely used content management systems on the internet, making it a frequent target for bots and hackers attempting brute-force attacks. A brute-force attack works by systematically trying passwords until finding the correct one. Login Delay Shield defends against this by adding a configurable delay after each failed login attempt. Since successful logins are never delayed, legitimate users experience no slowdown. This approach is particularly effective against bots that send thousands of login requests, as each failed attempt forces the attacker to wait before trying the next password. **Features:** * **Login delay** — Fixed or random delay on failed login attempts (1-10 seconds) * **Progressive delay** — Delay increases with each consecutive failed attempt from the same IP * **IP lockout** — Temporarily block IP addresses after too many failed attempts * **Username-aware lockout strategy** — Choose `IP only` or `IP + username` to reduce false positives on shared networks * **Login feedback** — Shows remaining attempts before lockout and a lockout countdown when blocked * **IP whitelist** — Bypass all security measures for trusted IPs (supports CIDR notation) * **Email notifications** — Receive alerts when failed login thresholds are reached * **Failed login log** — Track all failed attempts with a dashboard widget showing recent activity and 7-day trends * **XML-RPC protection** — Apply delays to XML-RPC authentication or block it entirely * **Custom login URL** — Move the login page to a custom URL to reduce automated bot traffic targeting `/wp-login.php` * **Log retention** — Automatic cleanup of old log entries (configurable retention period) * **Accessible admin interface** — WCAG 2.1 compliant with keyboard navigation and screen reader support * **Multilingual** — Translated into 18 languages including French, German, Spanish, Japanese, Chinese, Arabic, and more * Lightweight and compatible with other security plugins *This plugin is not a complete security solution — dedicated security plugins offer more comprehensive protection.* However, Login Delay Shield adds an effective layer of defense that works alongside your existing security measures without conflict. *Note: This plugin was formerly known as "WP Login Delay".* == Installation == 1. Upload the `wp-login-delay` folder to the `/wp-content/plugins/` directory 1. Activate the plugin through the 'Plugins' menu in WordPress 1. That's it, Login Delay Shield is installed and working == Frequently Asked Questions == = How does this plugin protect my site? = When a bot attempts a brute-force attack, it tries thousands of passwords as fast as possible. By adding a delay (even just 1 second) after each failed attempt, the attack becomes impractical. A one-second delay is barely noticeable to legitimate users but makes a huge difference when multiplied across thousands of attempts. = Where are the plugin settings? = Go to `Settings` > `Login Delay Shield` = What is progressive delay? = Progressive delay increases the wait time with each consecutive failed attempt from the same IP address. For example, the first failure might delay 1 second, the second failure 2 seconds, and so on. This makes repeated attacks increasingly slow. = How does IP lockout work? = After a configurable number of failed attempts (default: 10), login attempts are temporarily blocked. You can choose whether attempts are counted by `IP only` or by `IP + username` (recommended for shared office/mobile IPs). Lockout duration is configurable (default: 60 minutes). = What are the "attempts remaining" and countdown messages? = When lockout is enabled, failed logins show how many attempts remain before temporary lockout. If lockout is triggered, the error message includes a countdown (for example, "try again in 2 minutes") so users know when to retry. = How do I whitelist my own IP? = Enable the IP whitelist feature and add your IP address (or a range using CIDR notation like `192.168.1.0/24`). Whitelisted IPs bypass all delays and lockouts, ensuring you never lock yourself out. = Should I block XML-RPC? = If you don't use the WordPress mobile app or remote publishing tools like Windows Live Writer, blocking XML-RPC authentication removes a common attack vector. You can also choose to just apply delays without blocking it entirely. = How do email notifications work? = When enabled, the plugin tracks failed login attempts per IP address. Once the threshold is reached (default: 5 attempts), an email is sent to alert you. The counter resets after one hour of no failed attempts from that IP. = Where can I see failed login attempts? = A dashboard widget shows the 10 most recent failed login attempts, including the time, username attempted, IP address, and source. It also includes a lightweight 7-day trends panel with daily totals, top sources, and top IPs. = Is the admin interface accessible? = Yes! Login Delay Shield follows WCAG 2.1 accessibility guidelines. All settings are fully keyboard navigable, screen reader compatible, and include proper ARIA attributes. Collapsible sections can be toggled with Enter or Space keys, tooltips appear on focus (not just hover), and all dynamic changes are announced to assistive technologies. = Does this plugin work better with an object cache? = For high-traffic sites or sites experiencing frequent attacks, we recommend using a persistent object cache like Redis or Memcached. The plugin uses WordPress transients to track failed login attempts and lockouts per IP address. By default, transients are stored in the database. During a distributed brute-force attack (many IPs), this can create additional database queries. With an object cache installed: * Transient reads/writes go to memory instead of the database * Much faster performance under attack conditions * Reduced database load Popular object cache plugins: Redis Object Cache, W3 Total Cache, LiteSpeed Cache. Most managed WordPress hosts (WP Engine, Kinsta, Flywheel) include object caching by default. = What languages are supported? = Login Delay Shield is translated into 18 languages: * English (default) * Arabic (العربية) * Chinese Simplified (简体中文) * Czech (Čeština) * Dutch (Nederlands) * French (Français) * German (Deutsch) * Indonesian (Bahasa Indonesia) * Italian (Italiano) * Japanese (日本語) * Korean (한국어) * Polish (Polski) * Portuguese - Brazil (Português do Brasil) * Russian (Русский) * Spanish (Español) * Swedish (Svenska) * Thai (ไทย) * Turkish (Türkçe) * Vietnamese (Tiếng Việt) The plugin automatically uses your site's language setting. Want to help translate into another language? Visit [translate.wordpress.org](https://translate.wordpress.org/). == Screenshots == 1. Settings page with delay configuration options. 2. Email notification and IP lockout settings. 3. IP whitelist and XML-RPC protection settings. 4. Dashboard widget showing recent failed login attempts. == Contribute == Found a bug or want to suggest an improvement? Open a thread in the [support forum](https://wordpress.org/support/plugin/login-delay-shield/) on WordPress.org. Want to help translate the plugin into your language? Visit [translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/login-delay-shield/). == Changelog == = 2.2.3 = Complete Custom Login URL runtime, Trend Analytics queries, and bug fixes. **New Features:** * Custom Login URL runtime — custom slug now fully functional with login, logout, lost password, and password reset all routed through the custom URL. * Custom Login URL admin UI — settings card with enable/disable toggle, slug input, status badge, and tooltip help. * Trend Analytics query functions — `wldelay_get_top_ips()`, `wldelay_get_top_usernames()`, and `wldelay_get_daily_attempts()` for dashboard trend data. **Bug Fixes:** * Fixed double `wp_unslash()` on login username that could corrupt usernames with literal backslashes. * Fixed `wp_login_url` filter name (was `wp_login_url`, should be `login_url`) preventing URL rewriting. * Fixed canonical redirect leaking custom login slug via 302 when `/wp-login.php` is accessed through the front controller. * Fixed `login_init` blocking internal WordPress paths (e.g. `/wp/wp-login.php`) used for legitimate auth redirects. **Improvements:** * Expanded reserved slug list with `wp-json`, `wp-content`, `wp-includes`, `wp-signup`, `wp-activate`, `xmlrpc`, `feed`, `robots`, `sitemap`. * Replaced production `wldelay_unlock_current_ip_should_exit` filter with `WP_TESTS_DOMAIN` constant check — no longer exposes a testability surface in production. * Wrapped Custom Login URL section titles in `esc_html__()` for i18n completeness. * Added Custom Login URL to the protection features summary box. * Added Playwright end-to-end tests for full Custom Login URL verification. = 2.2.2 = Micro-hardening — input sanitization, i18n completeness, and code documentation. **Improvements:** * Added `wp_unslash()` before `sanitize_user()` in login username extraction to correctly handle WordPress magic-quote slashes. * Wrapped email notification subject and body in `__()` for full i18n/l10n support. * Added detailed inline comments explaining the IPv6 CIDR binary mask bit-shift logic. = 2.2.1 = Code housekeeping — JavaScript extraction and admin UI consistency. **Improvements:** * Extracted all inline JavaScript from the settings page view into a standalone `admin.js` file, loaded via `wp_enqueue_script()`. * Used `wp_localize_script()` to pass PHP-side translatable strings to JavaScript (Enabled/Disabled badge labels). * Standardized `