@@ -102,7 +102,7 @@ |
||
| 102 | 102 | $formParameters['limit'] = $this->limit; |
| 103 | 103 | $this->assign('searchParamsUrl', http_build_query($formParameters, '', '&')); |
| 104 | 104 | |
| 105 | - foreach ($formParameters as $key => $value) { |
|
| 105 | + foreach ($formParameters as $key => $value) { |
|
| 106 | 106 | $this->assign($key, $value); |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -58,7 +58,8 @@ |
||
| 58 | 58 | /** |
| 59 | 59 | * This feels like the least bad place to put this method. |
| 60 | 60 | */ |
| 61 | - public static function getTaskDescriptions() { |
|
| 61 | + public static function getTaskDescriptions() |
|
| 62 | + { |
|
| 62 | 63 | return array( |
| 63 | 64 | BotCreationTask::class => 'Create account (via bot)', |
| 64 | 65 | UserCreationTask::class => 'Create account (via OAuth)', |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | $users = UserSearchHelper::get($database)->inIds( |
| 22 | 22 | $database->query('SELECT user FROM oauthtoken WHERE type = \'access\'')->fetchColumn()); |
| 23 | 23 | |
| 24 | - foreach ($users as $u){ |
|
| 24 | + foreach ($users as $u) { |
|
| 25 | 25 | $oauth = new OAuthUserHelper($u, $database, $this->getOAuthProtocolHelper(), $this->getSiteConfiguration()); |
| 26 | 26 | $oauth->detach(); |
| 27 | 27 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | |
| 228 | 228 | $entryComment = $entry->getComment(); |
| 229 | 229 | |
| 230 | - if($entry->getAction() === 'JobIssueRequest' || $entry->getAction() === 'JobCompletedRequest'){ |
|
| 230 | + if($entry->getAction() === 'JobIssueRequest' || $entry->getAction() === 'JobCompletedRequest') { |
|
| 231 | 231 | $data = unserialize($entry->getComment()); |
| 232 | 232 | /** @var JobQueue $job */ |
| 233 | 233 | $job = JobQueue::getById($data['job'], $database); |
@@ -243,7 +243,8 @@ discard block |
||
| 243 | 243 | 'jobId' => $job->getId(), |
| 244 | 244 | 'jobDesc' => JobQueue::getTaskDescriptions()[$job->getTask()], |
| 245 | 245 | ); |
| 246 | - } else { |
|
| 246 | + } |
|
| 247 | + else { |
|
| 247 | 248 | $requestLogs[] = array( |
| 248 | 249 | 'type' => 'log', |
| 249 | 250 | 'security' => 'user', |
@@ -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; |
@@ -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 | |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | |
| 63 | 63 | $usedToken = null; |
| 64 | 64 | foreach ($scratchTokens as $scratchToken) { |
| 65 | - if (password_verify($data, $scratchToken)){ |
|
| 65 | + if (password_verify($data, $scratchToken)) { |
|
| 66 | 66 | $usedToken = $scratchToken; |
| 67 | 67 | SessionAlert::quick("Hey, it looks like you used a scratch token to log in. Would you like to change your multi-factor authentication configuration?", 'alert-warning'); |
| 68 | 68 | WebRequest::setPostLoginRedirect($this->getConfiguration()->getBaseUrl() . "/internal.php/multiFactor"); |
@@ -44,7 +44,8 @@ |
||
| 44 | 44 | $userObj = User::getByUsername($filterUser, $database); |
| 45 | 45 | if ($userObj !== false) { |
| 46 | 46 | $logSearch->byUser($userObj->getId()); |
| 47 | - } else { |
|
| 47 | + } |
|
| 48 | + else { |
|
| 48 | 49 | $logSearch->byUser(-1); |
| 49 | 50 | } |
| 50 | 51 | } |