toplan/laravel-sms

verify_code验证

wilbur-yu opened this issue · 2 comments

验证码验证时候,如果没有调用发送验证时接口,直接调用登录认证接口,verify_code验证会报未定义attempts错误.
此情况是在'非正常使用'的情况下会发生.

你可以自己在validations.php中修改Validator::extend('verify_code', function ($attribute, $value)函数,来解决这个问题~~
Validator::extend('verify_code', function ($attribute, $value) {
$state = SmsManager::retrieveState();
if($state==[])
return false;
$maxAttempts = config('laravel-sms.verifyCode.maxAttempts', 0);
$attempts = $state['attempts'] + 1;
.....

该问题同 #114