KHALAF Mobile Authenticator & 2FA

Description

KHALAF Mobile Authenticator & 2FA adds Two-Factor Authentication (2FA) to your WordPress website without subscriptions or third-party cloud dependencies.

Protect your admin dashboard and user accounts against brute-force attacks, credential stuffing, and password leaks using standard Time-Based One-Time Passwords (TOTP) and Email OTP fallback.

Key Features

  • Universal Mobile Authenticator Compatibility: Works with Google Authenticator, Microsoft Authenticator, 2FAS, Authy, and any standard RFC 6238 TOTP authenticator app on iOS and Android.
  • Email OTP Verification Fallback: Request a temporary, one-time 6-digit login verification code sent to your registered account email address.
  • Privacy & Local QR Generation: QR codes are generated directly in your browser using local client-side scripts. Your 2FA secrets are never sent to external APIs or remote servers.
  • Brute-Force & Rate Limiting Defense: Automatic lockout after consecutive failed verification attempts with a live countdown timer.
  • Hashed Emergency Backup Codes: Generates 8 single-use recovery codes stored as WordPress password hashes. Download as .txt or send them to your email during setup.
  • Role-Based 2FA Enforcement: Require 2FA for all Administrators or specific user roles (Editor, Author, Shop Manager, etc.).
  • Admin Setup Enforcement: Enforced users are restricted to the 2FA setup screen until they configure their 2FA credentials.
  • Application Passwords Shield: Automatically disables core application passwords for 2FA-protected accounts when enabled in settings.
  • Lightweight Architecture: No custom database tables created. Uses standard WordPress options, transients, and user meta.

How the Email OTP Fallback Works

When logging in, users can click “Send Code to Email”. The plugin generates a cryptographically random 6-digit code, stores it as an expiring hash transient (5-minute validity), and emails it to the user. A 60-second cooldown prevents repeated email requests. The same login input accepts the code.

Third-Party Libraries

  • QRCode.js (assets/js/qrcode.min.js, full unminified source included at assets/js/qrcode.js) — Client-side QR code generator, licensed under the MIT License (https://github.com/davidshimjs/qrcodejs).

Screenshots

Installation

  1. Upload the plugin files to the /wp-content/plugins/khalaf-mobile-authenticator-2fa directory, or install directly through the WordPress plugins screen.
  2. Activate the plugin through the Plugins screen in WordPress.
  3. Navigate to KHALAF 2FA My 2FA Security (or your User Profile) to scan your QR code with your mobile authenticator app.
  4. Enter the 6-digit code from your mobile app and click Verify & Enable.
  5. Save your 8 emergency backup codes.

FAQ

Which mobile authenticator apps are supported?

Any application supporting the standard RFC 6238 TOTP protocol is supported, including:
* Google Authenticator (Android / iOS)
* Microsoft Authenticator (Android / iOS)
* 2FAS Authenticator (Open Source, Android / iOS)
* Twilio Authy
* Bitwarden / 1Password / Apple Keychain

What happens if I lose my phone?

You have two immediate recovery methods:
1. Email OTP Fallback: Click “Send Code to Email” on the login screen to receive a single-use 6-digit code.
2. Emergency Backup Codes: Enter any of the 8 recovery codes generated when you set up 2FA.

What if the Primary Administrator loses both their phone and backup codes?

For security, other administrators cannot disable 2FA on the Primary Administrator’s account from the WordPress dashboard. In that situation, the Primary Administrator can still log in using Email OTP Fallback (if enabled) or recover access directly via the database by deleting the _two_fa_khalaf_enabled user meta row for their user ID.

Are QR codes generated through Google Charts or any external service?

No. For maximum privacy and security, QR codes are generated 100% locally in your browser using client-side JavaScript. Your secret key never leaves your server.

Can administrators enforce 2FA for specific user roles?

Yes. In the KHALAF 2FA Settings panel, administrators can enforce two-factor authentication on all administrators or any specific user roles (e.g., Shop Manager, Editor).

Does this plugin slow down my site?

The plugin has zero external dependencies, makes no external HTTP requests, and loads assets only on the login screen and dedicated 2FA administration screens.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“KHALAF Mobile Authenticator & 2FA” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

1.0.0

  • Initial public release.
  • Added TOTP authentication for all standard mobile authenticator apps.
  • Added Email OTP verification fallback with cooldown rate limiting.
  • Added hashed emergency backup codes.
  • Added brute-force lockout protection with live countdown timer.
  • Added role-based 2FA enforcement and administrative settings hub.