Password reset in Moodle is traditionally email-based, but that doesn’t always fit real-world usage, especially in mobile-first environments or regions where email access is inconsistent.

To address this, I built a lightweight plugin that enables SMS-based password reset:

👉 https://github.com/dirar/sms_password_reset

This post explains what it does, how it works, and where it fits best.

Why Add SMS Reset to Moodle?

Out of the box, Moodle relies on email for password recovery. That’s fine in many cases, but it introduces friction:

  • Users don’t always have reliable email access
  • Reset emails can be delayed or flagged as spam
  • Mobile users prefer phone-based verification
  • Some deployments use phone numbers as the primary identifier

Adding SMS support provides a more direct and accessible reset flow.


What This Plugin Does

This plugin adds an OTP-based password reset flow via SMS:

  1. User enters their phone number
  2. A one-time password (OTP) is generated
  3. OTP is sent via SMS
  4. User verifies the code
  5. User resets their password

It integrates into Moodle’s authentication/reset flow without breaking existing functionality.


How It Works (High-Level)

The plugin keeps things simple and modular:

🔹 OTP Generation

  • Short-lived code (e.g., 4–6 digits)
  • Stored securely (hashed, not plain text)

🔹 SMS Delivery

  • Works with external SMS gateways (configurable)
  • Can be adapted for local providers

🔹 Verification Layer

  • Validates OTP
  • Enforces expiration
  • Limits retry attempts

🔹 Password Update

  • Allows reset only after successful verification
  • Invalidates OTP immediately after use

Security Considerations

SMS-based systems need careful handling. This plugin includes (or is designed to support):

  • OTP expiration (short validity window)
  • Rate limiting (prevent brute force attempts)
  • Hashed OTP storage
  • One-time use enforcement
  • Minimal user enumeration exposure

You should still align it with your organization’s security policies.


Integration with Moodle

The plugin is designed to fit naturally into Moodle:

  • Hooks into the password reset process
  • Can coexist with email reset (optional fallback)
  • Configurable via Moodle admin settings
  • Extendable for custom authentication flows

When This Is Useful

This plugin is particularly helpful for:

  • Schools and institutions with mobile-first users
  • Training platforms in regions with limited email usage
  • Systems where phone number is the primary login
  • Government or NGO deployments requiring simpler UX

Possible Enhancements

Depending on your use case, you might extend it with:

  • Multi-channel reset (SMS + email)
  • Integration with national SMS gateways
  • Logging and audit trails
  • Admin dashboard for OTP monitoring
  • Support for multi-factor authentication (MFA)

Final Thoughts

For many Moodle deployments, email-based password reset is no longer enough.

Adding SMS-based recovery improves:

  • Accessibility
  • User experience
  • Completion rates

This plugin is a simple way to introduce that capability without overengineering the solution.