WordPress plugin for mobile-based authentication with OTP and password support.
Mobile Auth provides a seamless login and registration experience using mobile phone numbers. Users can authenticate via SMS OTP or password, offering flexibility and speed.
- 📱 Mobile OTP Authentication - Secure SMS-based verification
- 🔑 Password Login - Fast login without waiting for SMS
- 🔄 Dual Method Support - Users choose their preferred method
- ✅ Auto Registration - New users automatically registered on first OTP
- ⚡ Instant Password Login - No SMS delays
- 🌐 Persian/Farsi Interface - Full RTL support
- 🔢 Persian Number Conversion - Handles both Persian and English digits
- 📱 Mobile-First Design - Responsive and modern UI
- ↪️ Smart Redirects - Remember where users wanted to go
- 🔒 Forced Password Setup - New users must set password
- 🆘 Password Reset via OTP - Forgot password recovery
- 🔑 Admin Backdoor - Secret admin access (
? admin_key=hn) - ⏱️ 30-Day Sessions - Persistent login
- 🛡️ WordPress Security Standards - Native password hashing
- 📧 WooCommerce Compatible - Works with My Account pages
- 📮 Kavenegar SMS API - Reliable OTP delivery
- 🎨 Custom Styling - Clean, professional design
- 🔌 Easy Setup - Automatic page creation on activation
- Upload the plugin files to
/wp-content/plugins/mobile-auth/ - Activate the plugin through the 'Plugins' menu in WordPress
- Plugin automatically creates
/authand/secret-admin-loginpages - Configure your Kavenegar API key in
mobile-auth.php(line 100)
- WordPress 5.0+
- PHP 7.0+
- WooCommerce (optional, for profile integration)
- Kavenegar SMS account
- Enter mobile number (09xxxxxxxxx format)
- Receive and enter OTP code
- Set password (required)
- Redirected to profile page
- Enter mobile number
- Choose login method:
- 📱 Send OTP - Receive SMS code
- 🔑 Use Password - Instant login
- Complete authentication
- Users can change passwords in My Account → Edit Account
- Forgot password? Use OTP verification to reset
| Feature | OTP Only | With Password |
|---|---|---|
| Login Speed | 30-60 seconds | 2 seconds ⚡ |
| Works Offline | ❌ | ✅ |
| SMS Cost | Every login | Only registration |
| User Experience | Wait required | Instant access |
Estimated SMS Cost Savings: 50-80% reduction
Edit line 100 in mobile-auth.php with your Kavenegar API key:
$url = "https://api.kavenegar.com/v1/YOUR_API_KEY_HERE/verify/lookup. json?" . - Standard login:
yoursite.com/wp-login.php?admin_key=hn - Change the key in line 54 to customize
🔑 Password Authentication Update
- ✨ Password login option - Users can now login with password instead of waiting for OTP
- 🔒 Forced password setup - New users must set a password during first registration
- 🔄 Login method selection - Choose between OTP or Password on each login
- 🔑 Password management - Change password in account settings
- 🆘 Forgot password flow - Reset password via OTP verification
- 📱 Dual authentication - Both OTP and password methods work simultaneously
- ⚡ Faster logins - Instant access with password (no SMS wait)
- 💰 Reduced SMS costs - Up to 50% savings when users choose password
- 📶 Works offline - Login even without SMS signal
- 😊 Better UX - Users choose their preferred method
Initial Release
- 📱 Mobile-based authentication (Iranian format: 09xxxxxxxxx)
- 🔐 OTP verification via SMS (Kavenegar API)
- ✅ Combined login/register on single page
- 🔄 Auto-registration for new users
- 🌐 Persian/Farsi UI with number conversion
- 🔒 Admin backdoor with secret key
- ↪️ Smart redirect handling
- 🎨 Modern, responsive design
- ⏱️ 30-day session persistence
We follow Semantic Versioning: MAJOR.MINOR.PATCH
- MAJOR (1.x.x) - Breaking changes
- MINOR (x. 2.x) - New features, backward compatible
- PATCH (x.x.1) - Bug fixes
Current Version: 1.2.0
mobile-auth/
├── mobile-auth.php # Main plugin file
├── README.md # Documentation
├── assets/
│ └── style.css # UI styling
└── templates/
├── auth. php # Main authentication page
├── set-password.php # Password setup (new users)
└── forgot-password.php # Password reset flow
- Passwords hashed using WordPress native functions (
wp_hash_password()) - OTP codes expire after 3 minutes (180 seconds)
- Mobile numbers stored uniquely (prevents duplicates)
- Session cookies: 30-day expiration
- CSRF protection via WordPress nonces
- Input sanitization and validation
- Iranian mobile numbers only:
09xxxxxxxxx(11 digits) - Converts Persian/Arabic numerals to English automatically
- Validates format before sending OTP
Author: Milad Karimi ( Ver 1.1 ) Soroush Yasini ( Ver 1.2)
Version: 1.2.0
License: GPL-2.0+
Contributions are welcome! Please feel free to submit pull requests or open issues.
For issues or questions:
- Open an issue on GitHub
- Check existing documentation
- Review code comments
This plugin is licensed under the GPL-2.0+ License.
Made with ❤️ for WordPress