@@ -229,7 +229,8 @@ discard block |
||
| 229 | 229 | $this->deleteCredential($database, $currentUser, $otpCredentialProvider, $factorType); |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | - protected function enableU2F() { |
|
| 232 | + protected function enableU2F() |
|
| 233 | + { |
|
| 233 | 234 | $database = $this->getDatabase(); |
| 234 | 235 | $currentUser = User::getCurrent($database); |
| 235 | 236 | |
@@ -336,7 +337,8 @@ discard block |
||
| 336 | 337 | } |
| 337 | 338 | } |
| 338 | 339 | |
| 339 | - protected function disableU2F() { |
|
| 340 | + protected function disableU2F() |
|
| 341 | + { |
|
| 340 | 342 | $database = $this->getDatabase(); |
| 341 | 343 | $currentUser = User::getCurrent($database); |
| 342 | 344 | |
@@ -93,7 +93,8 @@ discard block |
||
| 93 | 93 | return $this->configuration; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - public function deleteCredential(User $user) { |
|
| 96 | + public function deleteCredential(User $user) |
|
| 97 | + { |
|
| 97 | 98 | // get this factor |
| 98 | 99 | $statement = $this->database->prepare('SELECT * FROM credential WHERE user = :user AND type = :type'); |
| 99 | 100 | $statement->execute(array(':user' => $user->getId(), ':type' => $this->type)); |
@@ -143,7 +144,8 @@ discard block |
||
| 143 | 144 | * |
| 144 | 145 | * @return bool |
| 145 | 146 | */ |
| 146 | - public function userIsEnrolled($userId) { |
|
| 147 | + public function userIsEnrolled($userId) |
|
| 148 | + { |
|
| 147 | 149 | $cred = $this->getCredentialData($userId); |
| 148 | 150 | |
| 149 | 151 | return $cred !== null; |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | |
| 61 | 61 | $usedToken = null; |
| 62 | 62 | foreach ($scratchTokens as $scratchToken) { |
| 63 | - if (password_verify($data, $scratchToken)){ |
|
| 63 | + if (password_verify($data, $scratchToken)) { |
|
| 64 | 64 | $usedToken = $scratchToken; |
| 65 | 65 | break; |
| 66 | 66 | } |
@@ -26,8 +26,7 @@ discard block |
||
| 26 | 26 | public function authenticate(User $user, $data) |
| 27 | 27 | { |
| 28 | 28 | $storedData = $this->getCredentialData($user->getId()); |
| 29 | - if($storedData === null) |
|
| 30 | - { |
|
| 29 | + if($storedData === null) { |
|
| 31 | 30 | // No available credential matching these parameters |
| 32 | 31 | return false; |
| 33 | 32 | } |
@@ -38,7 +37,7 @@ discard block |
||
| 38 | 37 | } |
| 39 | 38 | |
| 40 | 39 | if(password_verify($data, $storedData->getData())) { |
| 41 | - if(password_needs_rehash($storedData->getData(), self::PASSWORD_ALGO, array('cost' => self::PASSWORD_COST))){ |
|
| 40 | + if(password_needs_rehash($storedData->getData(), self::PASSWORD_ALGO, array('cost' => self::PASSWORD_COST))) { |
|
| 42 | 41 | $this->setCredential($user, $storedData->getFactor(), $data); |
| 43 | 42 | } |
| 44 | 43 | |
@@ -52,7 +51,7 @@ discard block |
||
| 52 | 51 | { |
| 53 | 52 | $storedData = $this->getCredentialData($user->getId()); |
| 54 | 53 | |
| 55 | - if($storedData === null){ |
|
| 54 | + if($storedData === null) { |
|
| 56 | 55 | $storedData = $this->createNewCredential($user); |
| 57 | 56 | } |
| 58 | 57 | |