ferdousulhaque / laravel-otp-validate

Laravel package for OTP validation with built-in features like max retry and resend mechanism. Both OTP/Security Code over SMS or Email or AWS SNS of your choice with template user-defined.
71 stars 13 forks source link

Resend Service is disabled code 503 is working wrong #16

Open ihemantkumar opened 1 year ago

ihemantkumar commented 1 year ago

I have setup max-send and max-resend to 5 and after requesting the OTP twice one using OtpValidator::requestOtp() and another using OtpValidator::validateOtp() code is showing error Resend Service is disabled with code: 503

When I checked the database, I found there was 1 entry for today, 1 from 6 days earlier and 4 entries from 20 days ago. It seems plugin is only checking the old OTP entries via client_req_id instead of client_req_id + created_at.

Upon more inspection I found that the core method countResend() is just using client_req_id and type to fetch the resend count. The query should have included the time as well.

Screenshot from 2023-09-12 23-36-15

ferdousulhaque commented 1 year ago

Thanks for the suggestion, let me work on it