| Conditions | 9 |
| Paths | 6 |
| Total Lines | 20 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 16.1088 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 25 | public function checkPostAuth(UserInterface $user) { |
||
| 26 | if(!$user instanceof User) { |
||
| 27 | return; |
||
| 28 | } |
||
| 29 | 13 | ||
| 30 | 13 | // First check: is the user account marked "active"? |
|
| 31 | if($user->isActive() !== true) { |
||
| 32 | throw new AccountDisabledException(); |
||
| 33 | } |
||
| 34 | |||
| 35 | 13 | // Second check: does the user has a time window in which the account is active? |
|
| 36 | 1 | if($user->getEnabledFrom() !== null || $user->getEnabledUntil() !== null) { |
|
| 37 | $today = $this->dateHelper->getToday(); |
||
| 38 | |||
| 39 | 12 | if($user->getEnabledFrom() !== null && $user->getEnabledFrom() > $today) { |
|
| 40 | throw new AccountDisabledException(); |
||
| 41 | } |
||
| 42 | |||
| 43 | if($user->getEnabledUntil() !== null && $user->getEnabledUntil() < $today) { |
||
| 44 | throw new AccountDisabledException(); |
||
| 45 | } |
||
| 48 | } |