public function MobileNumberUtil::checkFlood in Mobile Number 2.0.x
Same name and namespace in other branches
- 8 src/MobileNumberUtil.php \Drupal\mobile_number\MobileNumberUtil::checkFlood()
Checks whether there were too many verifications attempted with the current number.
Parameters
\libphonenumber\PhoneNumber $mobile_number: Phone number object.
string $type: Flood type, 'sms' or 'verification'.
Return value
bool FALSE for too many attempts on this mobile number, TRUE otherwise.
Overrides MobileNumberUtilInterface::checkFlood
File
- src/
MobileNumberUtil.php, line 232
Class
- MobileNumberUtil
- Turns a render array into a HTML string.
Namespace
Drupal\mobile_numberCode
public function checkFlood(PhoneNumber $mobile_number, $type = 'verification') {
switch ($type) {
case 'verification':
return $this->flood
->isAllowed('mobile_number_verification', $this::VERIFY_ATTEMPTS_COUNT, $this::VERIFY_ATTEMPTS_INTERVAL, $this
->getCallableNumber($mobile_number));
case 'sms':
return $this->flood
->isAllowed('mobile_number_sms', $this::SMS_ATTEMPTS_COUNT, $this::SMS_ATTEMPTS_INTERVAL, $this
->getCallableNumber($mobile_number)) && $this->flood
->isAllowed('mobile_number_sms_ip', $this::SMS_ATTEMPTS_COUNT * 5, $this::SMS_ATTEMPTS_INTERVAL * 5);
default:
return TRUE;
}
}