WCA Auth Engine is a high-performance, decoupled authentication and registration system built specifically for WooCommerce and WordPress (Single-Site & Multisite).
It replaces native WordPress/WooCommerce login and registration forms with an optimized, REST-API-driven pipeline featuring pre-database registration gating, multi-identifier authentication (Email, Username, or Phone), dual OTP verification (Native Email + TextMagic SMS), and WooCommerce checkout field locking.
Standard WordPress registration immediately inserts unverified users into wp_users. WCA Auth Engine uses a decoupled 3-Phase Transient Pipeline:
- Phase 1 (Initiate): Validates payload, hashes passwords immediately, and stores session data inside temporary encrypted transients. Zero database user rows are created.
- Phase 2 (Verify): User completes verification via Email magic link/token or SMS OTP code. Transient flags (
email_verified,sms_verified) are updated. - Phase 3 (Complete): Once verified,
wp_create_user()is called, user meta (billing_phone,billing_phone_verified,billing_email_verified) is attached, authentication cookies are set, and transients are purged.
Users can log in or initiate passwordless verification using any valid identifier:
- Email Address (
user@example.com) - Username (
john_doe) - Phone Number (
+1234567890)
- Native Email Verification: HTML email templates rendered via
WCA_Template_Engineand sent through nativewp_mail(). - SMS Verification: Built-in TextMagic API integration (
WCA_TextMagic_Client) with customizable SMS message templates. - Flexible Channels: Users can choose between SMS and Email OTP or switch channels seamlessly during verification.
- Field Locking: Locks
billing_phoneandbilling_emailon the WooCommerce Checkout page to match the authenticated user's verified contact details, preventing spoofed checkouts. - Checkout Enforcement: Enforces valid account status and phone/email verification prior to order placement.
- Intercepts WooCommerce "Edit Account" and billing profile fields.
- Updating phone numbers or email addresses automatically flags the account for OTP re-verification before saving changes to user meta.
Lightweight, responsive AJAX/REST API frontend modals (frontend/templates/) powered by Alpine.js:
- Modal Register (
modal-register.php) - Modal Login (
modal-login.php) - Modal OTP Verification (
modal-otp-verify.php) - Modal Password Reset (
modal-forgot-password.php) - Modal Profile Update (
modal-profile-update.php) - Modal Add Phone (
modal-add-phone.phpfor legacy users)
- Adds Phone, Phone Status, and Email Status columns directly to WordPress User tables (
wp-admin/users.php). - Provides network-wide options management for WordPress Multisite networks (
WCA_Network_Admin). - Built-in log viewer (
WCA_Log_Viewer) and email test controller (WCA_Email_Test_Controller).
wca-auth-engine/
βββ wca-auth-engine.php # Main plugin bootstrap & hook registration
βββ uninstall.php # Cleanup script on plugin deletion
βββ email-templates/ # Responsive HTML email templates
β βββ login-otp.html
β βββ password-reset.html
β βββ profile-update-verify.html
β βββ registration-verify.html
βββ frontend/ # Decoupled frontend assets & templates
β βββ css/
β β βββ wca-auth.css # Styles for authentication modals
β βββ js/
β β βββ wca-auth-app.js # Alpine.js application controller
β β βββ wca-otp-input.js # Auto-focusing OTP input handler
β β βββ wca-admin-settings.js # Admin dashboard JS
β βββ templates/ # PHP Modal view templates
β βββ modal-add-phone.php
β βββ modal-forgot-password.php
β βββ modal-login.php
β βββ modal-otp-verify.php
β βββ modal-profile-update.php
β βββ modal-register.php
β βββ modal-reverify-email.php
βββ includes/ # Core PHP classes & modules
βββ class-wca-activator.php # Activation setup & DB migrations
βββ class-wca-autoloader.php # Class autoloader
βββ class-wca-constants.php # Namespace, TTL, and config constants
βββ class-wca-deactivator.php # Deactivation cleanup
βββ admin/ # Admin screens & user table integration
β βββ class-wca-admin-user-tools.php
β βββ class-wca-email-test-controller.php
β βββ class-wca-log-viewer.php
β βββ class-wca-login-notify.php
β βββ class-wca-network-admin.php
β βββ class-wca-settings.php
β βββ class-wca-user-table-columns.php
βββ api/ # REST API endpoints (custom-auth/v1)
β βββ class-wca-api-router.php
β βββ endpoints/
β βββ class-wca-endpoint-add-phone.php
β βββ class-wca-endpoint-login.php
β βββ class-wca-endpoint-otp.php
β βββ class-wca-endpoint-password.php
β βββ class-wca-endpoint-profile.php
β βββ class-wca-endpoint-register.php
βββ auth/ # Authentication core logic
β βββ class-wca-auth-engine.php
β βββ class-wca-identifier-resolver.php
β βββ class-wca-session-manager.php
βββ checkout/ # WooCommerce checkout field locking & protection
β βββ class-wca-checkout-field-locker.php
β βββ class-wca-checkout-guard.php
βββ email/ # Email dispatch & template engine
β βββ class-wca-email-client.php
β βββ class-wca-template-engine.php
βββ integrations/ # External integrations
β βββ class-wca-textmagic-client.php
βββ logging/ # Audit logging
β βββ class-wca-logger.php
βββ migration/ # User account migration tools
β βββ class-wca-account-migrator.php
βββ otp/ # OTP generation, dispatching, and validation
β βββ class-wca-otp-dispatcher.php
β βββ class-wca-otp-generator.php
β βββ class-wca-otp-validator.php
βββ profile/ # Profile verification & updating
β βββ class-wca-profile-update-manager.php
β βββ class-wca-profile-verifier.php
βββ registration/ # Pre-database registration pipeline
β βββ class-wca-registration-completer.php
β βββ class-wca-registration-pipeline.php
β βββ class-wca-registration-validator.php
βββ security/ # Security guards & rate limiters
β βββ class-wca-rate-limiter.php
β βββ class-wca-recaptcha.php
β βββ class-wca-registration-guard.php
β βββ class-wca-sanitizer.php
βββ transient/ # Encrypted transient store & cleanup janitor
βββ class-wca-transient-janitor.php
βββ class-wca-transient-store.php
All endpoints are registered under namespace custom-auth/v1:
POST /wp-json/custom-auth/v1/register/initiate- Initiates registration, validates input, stores transient payload, dispatches OTP.GET, POST /wp-json/custom-auth/v1/register/verify-email- Verifies email magic token.POST /wp-json/custom-auth/v1/register/verify-sms- Verifies SMS OTP code.POST /wp-json/custom-auth/v1/register/complete- Finalizes account creation intowp_usersand sets auth cookies.
POST /wp-json/custom-auth/v1/login/check-identifier- Resolves identifier (email, username, phone).POST /wp-json/custom-auth/v1/login/send-otp- Dispatches OTP for passwordless login.POST /wp-json/custom-auth/v1/login/authenticate- Authenticates user via password or OTP code.
POST /wp-json/custom-auth/v1/password/forgot- Initiates password reset flow.POST /wp-json/custom-auth/v1/password/verify-otp- Verifies reset OTP code.POST /wp-json/custom-auth/v1/password/reset- Sets new password.POST /wp-json/custom-auth/v1/profile/update-initiate- Triggers contact update with re-verification.POST /wp-json/custom-auth/v1/profile/verify-update- Verifies profile update OTP code.
- WordPress: 6.0 or higher
- WooCommerce: 7.0 or higher
- PHP: 8.1 or higher
- Clone or copy the plugin to your WordPress plugins directory:
cd wp-content/plugins/ git clone https://github.com/malikad778/woocommerce-otp-auth-engine.git wca-auth-engine - Activate WCA Auth Engine via Plugins > Installed Plugins (or Network Activate on Multisite).
- Configure TextMagic credentials, Email settings, and custom options in WCA Auth Engine > Settings.
Distributed under the GPLv2 or later License. See LICENSE for more information.
Developed with β€οΈ by Adnan Haider.