Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: otp expire after validation and clear expired #3

Open
mohssineAboutaj opened this issue Aug 7, 2024 · 3 comments
Open

bug: otp expire after validation and clear expired #3

mohssineAboutaj opened this issue Aug 7, 2024 · 3 comments

Comments

@mohssineAboutaj
Copy link

I created two API routes

  • /verify-OTP
  • /reset-password

The first one contains this code

$otp = Otp::identifier($request->email)->attempt($request->otp);

The second one contains the same line with the force password reset function
The code is working fine, but the problem is when the OTP is valid in one route, it's not valid in another, it says expired
This means I can only use that OTP in one route
Do you know how I can fix this?

Also, how can I clear the Expired codes

Note: I'm using database/mysql as cache driver

@sadiqsalau
Copy link
Owner

To implement password reset you will need three routes.

  • /forgot-password
  • /verify-otp
  • /reset-password

In the first route we will send the password reset OTP.
Second route will verify the OTP and automatically create a session in the cache for a password reset for that email.
Last route will accept an email address and a new password to update.

@mohssineAboutaj
Copy link
Author

Yup I know and I already have those 3 routes
The problem is when the OTP is verified in the first time (in verify-otp) in the next route it says not valid

@sadiqsalau
Copy link
Owner

Yup I know and I already have those 3 routes The problem is when the OTP is verified in the first time (in verify-otp) in the next route it says not valid

The OTP can only be verified once...

@sadiqsalau sadiqsalau reopened this Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants