FloodControl::getInstance()->registerUserContent('com.woltlab.wcf.multifactor.backup', $setupId);
$attempts = FloodControl::getInstance()->countUserContent('com.woltlab.wcf.multifactor.backup', $setupId, new \DateInterval('PT1H'));
if ($attempts['count'] > self::USER_ATTEMPTS_PER_HOUR) {
+ $field->value('');
$field->addValidationError(new FormFieldValidationError(
'flood',
'wcf.user.security.multifactor.backup.error.flood',
$userCode = \preg_replace('/\s+/', '', $field->getValue());
if ($this->findValidCode($userCode, $codes) === null) {
+ $field->value('');
$field->addValidationError(new FormFieldValidationError('invalid'));
}
})),
$minCounter = 0;
if (!$totp->validateTotpCode($field->getValue(), $minCounter, new \DateTime())) {
+ $field->value('');
$field->addValidationError(new FormFieldValidationError('invalid'));
}
$field->minCounter($minCounter);
FloodControl::getInstance()->registerUserContent('com.woltlab.wcf.multifactor.backup', $setupId);
$attempts = FloodControl::getInstance()->countUserContent('com.woltlab.wcf.multifactor.backup', $setupId, new \DateInterval('PT10M'));
if ($attempts['count'] > self::USER_ATTEMPTS_PER_TEN_MINUTES) {
+ $field->value('');
$field->addValidationError(new FormFieldValidationError(
'flood',
'wcf.user.security.multifactor.totp.error.flood',
$totp = new Totp($selectedDevice['secret']);
$minCounter = $selectedDevice['minCounter'];
if (!$totp->validateTotpCode($field->getValue(), $minCounter, new \DateTime())) {
+ $field->value('');
$field->addValidationError(new FormFieldValidationError('invalid'));
}
$field->minCounter($minCounter);