|
@@ 76-83 (lines=8) @@
|
| 73 |
|
$member->NoYubikeyCount += 1; |
| 74 |
|
$member->write(); |
| 75 |
|
$maxNoYubi = Config::inst()->get('YubikeyAuthenticator', 'MaxNoYubiLogin'); |
| 76 |
|
if ($maxNoYubi > 0 && $maxNoYubi <= $member->NoYubikeyCount) { |
| 77 |
|
$validationError = ValidationResult::create(false, |
| 78 |
|
_t('YubikeyAuthenticator.ERRORMAXYUBIKEY', 'Maximum login without yubikey exceeded')); |
| 79 |
|
self::updateForm($validationError, $form); |
| 80 |
|
$member->registerFailedLogin(); |
| 81 |
|
|
| 82 |
|
return null; |
| 83 |
|
} |
| 84 |
|
$date1 = new DateTime($member->Created); |
| 85 |
|
$date2 = new DateTime(date('Y-m-d')); |
| 86 |
|
|
|
@@ 90-98 (lines=9) @@
|
| 87 |
|
$diff = $date2->diff($date1)->format("%a"); |
| 88 |
|
$maxNoYubiDays = Config::inst()->get('YubikeyAuthenticator', 'MaxNoYubiLoginDays'); |
| 89 |
|
|
| 90 |
|
if ($maxNoYubiDays > 0 && $diff >= $maxNoYubiDays) { |
| 91 |
|
$validationError = ValidationResult::create(false, |
| 92 |
|
_t('YubikeyAuthenticator.ERRORMAXYUBIKEYDAYS', 'Maximum days without yubikey exceeded')); |
| 93 |
|
self::updateForm($validationError, $form); |
| 94 |
|
$member->registerFailedLogin(); |
| 95 |
|
|
| 96 |
|
return null; |
| 97 |
|
|
| 98 |
|
} |
| 99 |
|
|
| 100 |
|
return $member; |
| 101 |
|
} |