@@ -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 | } |
@@ -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 |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | SessionAlert::success('Enabled YubiKey OTP.'); |
82 | 82 | |
83 | 83 | $scratchProvider = new ScratchTokenCredentialProvider($database, $this->getSiteConfiguration()); |
84 | - if($scratchProvider->getRemaining($currentUser->getId()) < 3) { |
|
84 | + if ($scratchProvider->getRemaining($currentUser->getId()) < 3) { |
|
85 | 85 | $scratchProvider->setCredential($currentUser, 2, null); |
86 | 86 | $tokens = $scratchProvider->getTokens(); |
87 | 87 | $this->assign('tokens', $tokens); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | SessionAlert::success('Enabled TOTP.'); |
182 | 182 | |
183 | 183 | $scratchProvider = new ScratchTokenCredentialProvider($database, $this->getSiteConfiguration()); |
184 | - if($scratchProvider->getRemaining($currentUser->getId()) < 3) { |
|
184 | + if ($scratchProvider->getRemaining($currentUser->getId()) < 3) { |
|
185 | 185 | $scratchProvider->setCredential($currentUser, 2, null); |
186 | 186 | $tokens = $scratchProvider->getTokens(); |
187 | 187 | $this->assign('tokens', $tokens); |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | |
262 | 262 | list($data, $reqs) = $otpCredentialProvider->getRegistrationData(); |
263 | 263 | |
264 | - $u2fRequest =json_encode($data); |
|
264 | + $u2fRequest = json_encode($data); |
|
265 | 265 | $u2fSigns = json_encode($reqs); |
266 | 266 | |
267 | 267 | $this->addJs('/vendor/yubico/u2flib-server/examples/assets/u2f-api.js'); |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | SessionAlert::success('Enabled U2F.'); |
311 | 311 | |
312 | 312 | $scratchProvider = new ScratchTokenCredentialProvider($database, $this->getSiteConfiguration()); |
313 | - if($scratchProvider->getRemaining($currentUser->getId()) < 3) { |
|
313 | + if ($scratchProvider->getRemaining($currentUser->getId()) < 3) { |
|
314 | 314 | $scratchProvider->setCredential($currentUser, 2, null); |
315 | 315 | $tokens = $scratchProvider->getTokens(); |
316 | 316 | $this->assign('tokens', $tokens); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | ':t' => $this->type |
56 | 56 | ); |
57 | 57 | |
58 | - if($disabled !== null) { |
|
58 | + if ($disabled !== null) { |
|
59 | 59 | $sql .= ' AND disabled = :d'; |
60 | 60 | $parameters[':d'] = $disabled ? 1 : 0; |
61 | 61 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $alternates = $statement->fetchColumn(); |
110 | 110 | $statement->closeCursor(); |
111 | 111 | |
112 | - if($alternates <= 1) { |
|
112 | + if ($alternates <= 1) { |
|
113 | 113 | // decrement the factor for every stage above this |
114 | 114 | $sql = 'UPDATE credential SET factor = factor - 1 WHERE user = :user AND factor > :factor'; |
115 | 115 | $statement = $this->database->prepare($sql); |
@@ -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; |
@@ -28,7 +28,7 @@ |
||
28 | 28 | protected function main() |
29 | 29 | { |
30 | 30 | $useOAuthSignup = $this->getSiteConfiguration()->getUseOAuthSignup(); |
31 | - if (! $this->getSiteConfiguration()->isRegistrationAllowed()) { |
|
31 | + if (!$this->getSiteConfiguration()->isRegistrationAllowed()) { |
|
32 | 32 | throw new AccessDeniedException(); |
33 | 33 | } |
34 | 34 |
@@ -32,7 +32,7 @@ |
||
32 | 32 | { |
33 | 33 | $useOAuthSignup = $this->getSiteConfiguration()->getUseOAuthSignup(); |
34 | 34 | if (! $this->getSiteConfiguration()->isRegistrationAllowed()) { |
35 | - throw new AccessDeniedException(); |
|
35 | + throw new AccessDeniedException(); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | // Dual-mode page |
@@ -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"); |
@@ -62,7 +62,7 @@ discard block |
||
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"); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
73 | - if($usedToken === null) { |
|
73 | + if ($usedToken === null) { |
|
74 | 74 | return false; |
75 | 75 | } |
76 | 76 |
@@ -36,13 +36,13 @@ discard block |
||
36 | 36 | 'ip' => '172.16.0.164', |
37 | 37 | 'routable' => false, |
38 | 38 | |
39 | - ],[ |
|
39 | + ], [ |
|
40 | 40 | 'trust' => true, |
41 | 41 | 'ip' => '198.51.100.123', |
42 | 42 | 'routable' => true, |
43 | 43 | 'rdns' => 'trustedproxy.example.com', |
44 | 44 | |
45 | - ],[ |
|
45 | + ], [ |
|
46 | 46 | 'trust' => true, |
47 | 47 | 'ip' => '192.0.2.1', |
48 | 48 | 'routable' => true, |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | 'ip' => '172.16.0.164', |
64 | 64 | 'routable' => false, |
65 | 65 | |
66 | - ],[ |
|
66 | + ], [ |
|
67 | 67 | 'trust' => false, |
68 | 68 | 'ip' => '198.51.100.234', |
69 | 69 | 'routable' => true, |
70 | 70 | 'rdns' => 'sketchyproxy.example.com', |
71 | 71 | 'showlinks' => true |
72 | 72 | |
73 | - ],[ |
|
73 | + ], [ |
|
74 | 74 | 'trust' => false, |
75 | 75 | 'ip' => '192.0.2.1', |
76 | 76 | 'routable' => true, |
@@ -91,12 +91,12 @@ discard block |
||
91 | 91 | 'ip' => '172.16.0.164', |
92 | 92 | 'routable' => false, |
93 | 93 | |
94 | - ],[ |
|
94 | + ], [ |
|
95 | 95 | 'trust' => true, |
96 | 96 | 'ip' => '198.51.100.123', |
97 | 97 | 'routable' => true, |
98 | 98 | 'rdns' => 'trustedproxy.example.com', |
99 | - ],[ |
|
99 | + ], [ |
|
100 | 100 | 'trust' => false, |
101 | 101 | 'ip' => '198.51.100.234', |
102 | 102 | 'routable' => true, |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | 'routable' => true, |
110 | 110 | 'rdns' => 'trustedproxy2.example.com', |
111 | 111 | 'showlinks' => true |
112 | - ],[ |
|
112 | + ], [ |
|
113 | 113 | 'trust' => false, |
114 | 114 | 'ip' => '192.0.2.1', |
115 | 115 | 'routable' => true, |
@@ -152,7 +152,7 @@ |
||
152 | 152 | { |
153 | 153 | $user = User::getById($id, $database); |
154 | 154 | |
155 | - if ($user === false || $user->isCommunityUser()) { |
|
155 | + if ($user === false || $user->isCommunityUser()) { |
|
156 | 156 | throw new ApplicationLogicException("Password reset failed. Please try again."); |
157 | 157 | } |
158 | 158 |
@@ -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 | } |
@@ -72,7 +72,8 @@ |
||
72 | 72 | if ($targetVar !== null && preg_match('/^[a-z]+$/', $targetVar)) { |
73 | 73 | $data = $targetVar . ' = ' . $data . ';'; |
74 | 74 | header("Content-Type: text/javascript"); |
75 | - } else { |
|
75 | + } |
|
76 | + else { |
|
76 | 77 | header("Content-Type: application/json"); |
77 | 78 | } |
78 | 79 |