| description | Let the user confirm sign-in with a time-based code from an authenticator app on their phone. |
|---|
This driver is a TOTP second factor. After a successful password login, the user types a six-digit code from an app such as Google Authenticator, 1Password, or Authy.
Unlike Email, the secret lives with the user. They must enrol before the driver can validate a sign-in.
composer require nails/driver-multi-factor-auth-authenticatorThis depends on nails/module-multi-factor-auth. Enable the driver after install.
requiresEnrollment() is true. Until the user has an Authenticator method, sign-in (when the group policy requires a challenge) sends them through setup:
setupStart()generates a 160-bit secret and anotpauth://totp/…URI (six digits, 30-second period).- The setup page shows a QR code and the secret for manual entry.
- They confirm with a code from the app.
setupComplete()checks it and stores the secret (and the matching time-step) on their user-method row. - Authenticator becomes their default method. They can change that later at
/mfa/manage.
Enrollment cannot be done from the console: the secret has to be shown to the user.
preForm()shows the configured prompt. Nothing is sent; the app already has the secret.validate()loads the enrolled secret, accepts the current 30-second window plus one step either side, and rejects a code that has already been used (last_period).- Request another verification code is not shown (
canTryAgain()isfalse).resend()is a no-op.
Configure the driver in Admin under Settings → MFA: Authenticator.
| Setting | Default | Meaning |
|---|---|---|
| Issuer name | (application name) | Label shown in authenticator apps. Leave blank to use APP_NAME |
| Prompt | Enter the code from your authenticator app. |
Flash message on the verification form |
| Invalid Code Entered | Invalid code entered. Please try again. |
Flash message on a bad or reused code |