Skip to content

Commit

Permalink
fix recently sent string
Browse files Browse the repository at this point in the history
  • Loading branch information
ibnnajjaar committed Sep 10, 2024
1 parent 654f5b1 commit 4bb5403
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lang/en/strings.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'exists' => 'The :attribute has already been taken.',
'doesnt-exist' => 'The :attribute does not exist.',
'locked' => 'The number is locked due to too many attempts.',
'recently_sent' => 'The code was recently sent to this number.'
'recently_sent' => 'The code was recently sent to this number. You can try again in :time.'
],
'country_code' => [
'invalid' => 'The country code is invalid.'
Expand Down
6 changes: 4 additions & 2 deletions src/Rules/IsValidMobileNumber.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,10 @@ public function validate(string $attribute, mixed $value, Closure $fail): void
$fail(trans('mobile-verification::strings.validation.number.locked'));
}

if ($mobile_number->was_sent_recently) { // todo: test
$fail(trans('mobile-verification::strings.validation.number.recently_sent'));
if ($mobile_number->was_sent_recently) {
$resend_verification_code_in_seconds = $mobile_number->resend_verification_code_in ?? 0;

$fail(trans('mobile-verification::strings.validation.number.recently_sent', ['time' => seconds_to_human_readable($resend_verification_code_in_seconds)]));
}
}
}
Expand Down

0 comments on commit 4bb5403

Please sign in to comment.