@@ -177,7 +177,7 @@ |
||
177 | 177 | throw new ApplicationLogicException('Cannot locate request'); |
178 | 178 | } |
179 | 179 | |
180 | - if($this->job->getEmailTemplate() !== null){ |
|
180 | + if($this->job->getEmailTemplate() !== null) { |
|
181 | 181 | $this->emailTemplate = EmailTemplate::getById($this->job->getEmailTemplate(), $this->getDatabase()); |
182 | 182 | |
183 | 183 | if ($this->emailTemplate === false) { |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | throw new ApplicationLogicException('Cannot locate request'); |
178 | 178 | } |
179 | 179 | |
180 | - if($this->job->getEmailTemplate() !== null){ |
|
180 | + if ($this->job->getEmailTemplate() !== null) { |
|
181 | 181 | $this->emailTemplate = EmailTemplate::getById($this->job->getEmailTemplate(), $this->getDatabase()); |
182 | 182 | |
183 | 183 | if ($this->emailTemplate === false) { |
@@ -185,20 +185,20 @@ discard block |
||
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
188 | - if($this->job->getParameters() !== null) { |
|
188 | + if ($this->job->getParameters() !== null) { |
|
189 | 189 | $this->parameters = json_decode($this->job->getParameters()); |
190 | 190 | |
191 | 191 | if (json_last_error() !== JSON_ERROR_NONE) { |
192 | - throw new ApplicationLogicException('JSON decode: ' . json_last_error_msg()); |
|
192 | + throw new ApplicationLogicException('JSON decode: '.json_last_error_msg()); |
|
193 | 193 | } |
194 | 194 | } |
195 | 195 | |
196 | 196 | // Should we wait for a parent job? |
197 | - if($this->job->getParent() !== null) { |
|
197 | + if ($this->job->getParent() !== null) { |
|
198 | 198 | /** @var JobQueue $parentJob */ |
199 | 199 | $parentJob = JobQueue::getById($this->job->getParent(), $this->getDatabase()); |
200 | 200 | |
201 | - if($parentJob === false) { |
|
201 | + if ($parentJob === false) { |
|
202 | 202 | $this->markFailed("Parent job could not be found"); |
203 | 203 | return; |
204 | 204 | } |
@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
133 | - $this->setHtmlTitle($statusSymbol . ' #' . $request->getId()); |
|
133 | + $this->setHtmlTitle($statusSymbol.' #'.$request->getId()); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -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); |
@@ -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 |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | SessionAlert::success('Enabled YubiKey OTP.'); |
78 | 78 | |
79 | 79 | $scratchProvider = new ScratchTokenCredentialProvider($database, $this->getSiteConfiguration()); |
80 | - if($scratchProvider->getRemaining($currentUser->getId()) < 3) { |
|
80 | + if ($scratchProvider->getRemaining($currentUser->getId()) < 3) { |
|
81 | 81 | $scratchProvider->setCredential($currentUser, 2, null); |
82 | 82 | $tokens = $scratchProvider->getTokens(); |
83 | 83 | $this->assign('tokens', $tokens); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | } |
88 | 88 | catch (ApplicationLogicException $ex) { |
89 | - SessionAlert::error('Error enabling YubiKey OTP: ' . $ex->getMessage()); |
|
89 | + SessionAlert::error('Error enabling YubiKey OTP: '.$ex->getMessage()); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | $this->redirect('multiFactor'); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | SessionAlert::success('Enabled TOTP.'); |
178 | 178 | |
179 | 179 | $scratchProvider = new ScratchTokenCredentialProvider($database, $this->getSiteConfiguration()); |
180 | - if($scratchProvider->getRemaining($currentUser->getId()) < 3) { |
|
180 | + if ($scratchProvider->getRemaining($currentUser->getId()) < 3) { |
|
181 | 181 | $scratchProvider->setCredential($currentUser, 2, null); |
182 | 182 | $tokens = $scratchProvider->getTokens(); |
183 | 183 | $this->assign('tokens', $tokens); |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | |
258 | 258 | list($data, $reqs) = $otpCredentialProvider->getRegistrationData(); |
259 | 259 | |
260 | - $u2fRequest =json_encode($data); |
|
260 | + $u2fRequest = json_encode($data); |
|
261 | 261 | $u2fSigns = json_encode($reqs); |
262 | 262 | |
263 | 263 | $this->addJs('/vendor/yubico/u2flib-server/examples/assets/u2f-api.js'); |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | SessionAlert::success('Enabled U2F.'); |
307 | 307 | |
308 | 308 | $scratchProvider = new ScratchTokenCredentialProvider($database, $this->getSiteConfiguration()); |
309 | - if($scratchProvider->getRemaining($currentUser->getId()) < 3) { |
|
309 | + if ($scratchProvider->getRemaining($currentUser->getId()) < 3) { |
|
310 | 310 | $scratchProvider->setCredential($currentUser, 2, null); |
311 | 311 | $tokens = $scratchProvider->getTokens(); |
312 | 312 | $this->assign('tokens', $tokens); |
@@ -419,11 +419,11 @@ discard block |
||
419 | 419 | |
420 | 420 | if ($result) { |
421 | 421 | $otpCredentialProvider->deleteCredential($currentUser); |
422 | - SessionAlert::success('Disabled ' . $factorType . '.'); |
|
422 | + SessionAlert::success('Disabled '.$factorType.'.'); |
|
423 | 423 | $this->redirect('multiFactor'); |
424 | 424 | } |
425 | 425 | else { |
426 | - SessionAlert::error('Error disabling ' . $factorType . ' - invalid credentials.'); |
|
426 | + SessionAlert::error('Error disabling '.$factorType.' - invalid credentials.'); |
|
427 | 427 | $this->redirect('multiFactor'); |
428 | 428 | } |
429 | 429 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | } |
135 | 135 | else { |
136 | 136 | // This is the login form, not the request form. We need protection here. |
137 | - $this->redirectUrl('https://' . WebRequest::serverName() . WebRequest::requestUri()); |
|
137 | + $this->redirectUrl('https://'.WebRequest::serverName().WebRequest::requestUri()); |
|
138 | 138 | |
139 | 139 | return false; |
140 | 140 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | throw new ApplicationLogicException('Unknown page handler for next authentication stage.'); |
279 | 279 | } |
280 | 280 | |
281 | - $this->redirect("login/" . $this->nextPageMap[$nextStage]); |
|
281 | + $this->redirect("login/".$this->nextPageMap[$nextStage]); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | private function setupAlternates(User $user, $partialStage, PdoDatabase $database) |
@@ -17,14 +17,14 @@ |
||
17 | 17 | { |
18 | 18 | list($partialId, $partialStage) = WebRequest::getAuthPartialLogin(); |
19 | 19 | |
20 | - if($partialId !== null && $partialStage > 1) { |
|
20 | + if ($partialId !== null && $partialStage > 1) { |
|
21 | 21 | $sql = 'SELECT type FROM credential WHERE user = :user AND factor = :stage AND disabled = 0 ORDER BY priority'; |
22 | 22 | $statement = $this->getDatabase()->prepare($sql); |
23 | 23 | $statement->execute(array(':user' => $partialId, ':stage' => $partialStage)); |
24 | 24 | $nextStage = $statement->fetchColumn(); |
25 | 25 | $statement->closeCursor(); |
26 | 26 | |
27 | - $this->redirect("login/" . $this->nextPageMap[$nextStage]); |
|
27 | + $this->redirect("login/".$this->nextPageMap[$nextStage]); |
|
28 | 28 | return; |
29 | 29 | } |
30 | 30 |
@@ -136,7 +136,7 @@ |
||
136 | 136 | |
137 | 137 | $data = array(); |
138 | 138 | foreach ($apiResponse as $key => $value) { |
139 | - $data[] = $key . "=" . $value; |
|
139 | + $data[] = $key."=".$value; |
|
140 | 140 | } |
141 | 141 | $dataString = implode('&', $data); |
142 | 142 |