seshac/otp-generator

It does not increment the no_times_attempt

Closed this issue · 3 comments

while we attempt
$verify = Otp::validate($identifier, $otp->token);
It does not increment no_times_attempt field in table.

The code is in OtpGenerator.php is in validate()

if ($otp->token == $token) {
return (object) [
'status' => true,
'message' => 'OTP is valid',
];
}

$otp->increment('no_times_attempted');

but it should be like below for proper functioning:

if ($otp->token == $token) {

$otp->increment('no_times_attempted');

return (object) [
'status' => true,
'message' => 'OTP is valid',
];
}

no_times_attempted will increment for failed attempted as well. thanks.

So you updated the code, right.

Yes!