[GH-ISSUE #878] EmailOTP does not respect password policy #8478

Closed
opened 2026-04-13 03:33:29 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @awesomepandapig on GitHub (Dec 13, 2024).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/878

Describe the bug
The Email OTP Plugin currently does not adhere to the password policy set in the emailAndPassword options.
For example:

emailAndPassword: {
    minPasswordLength: 12,
    maxPasswordLength: 100,
}

To Reproduce
Steps to reproduce the behavior:

  1. Send a request to /forget-password/email-otp
  2. Visit your inbox and retrieve the OTP
  3. Send a request to /email-otp/reset-password with an invalid password (ie: 123)
  4. Get a 200 response

Expected behavior
The request should match the behavior of the /sign-up/email endpoint and return a 400 error if the password is too long/short.

Screenshots
Bug behavior:
image

Expected behavior:
image

Package version

  • BetterAuth [1.0.19]
Originally created by @awesomepandapig on GitHub (Dec 13, 2024). Original GitHub issue: https://github.com/better-auth/better-auth/issues/878 **Describe the bug** The [Email OTP Plugin](https://www.better-auth.com/docs/plugins/email-otp) currently does not adhere to the password policy set in the `emailAndPassword` options. For example: ``` emailAndPassword: { minPasswordLength: 12, maxPasswordLength: 100, } ``` **To Reproduce** Steps to reproduce the behavior: 1. Send a request to `/forget-password/email-otp` 2. Visit your inbox and retrieve the OTP 3. Send a request to `/email-otp/reset-password` with an invalid password (ie: `123`) 4. Get a `200` response **Expected behavior** The request should match the behavior of the `/sign-up/email` endpoint and return a `400` error if the password is too long/short. **Screenshots** Bug behavior: ![image](https://github.com/user-attachments/assets/a327e308-88bb-490a-9546-14d12ef9a487) Expected behavior: ![image](https://github.com/user-attachments/assets/9b169e96-972d-48e8-b63e-cf318d654e1e) **Package version** - BetterAuth [1.0.19]
GiteaMirror added the locked label 2026-04-13 03:33:29 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#8478