@@ -52,8 +52,7 @@ |
||
| 52 | 52 | SessionAlert::success('Password changed successfully!'); |
| 53 | 53 | |
| 54 | 54 | $this->redirect('preferences'); |
| 55 | - } |
|
| 56 | - else { |
|
| 55 | + } else { |
|
| 57 | 56 | $this->assignCSRFToken(); |
| 58 | 57 | $this->setTemplate('preferences/changePassword.tpl'); |
| 59 | 58 | $this->addJs("/vendor/dropbox/zxcvbn/dist/zxcvbn.js"); |
@@ -46,8 +46,7 @@ discard block |
||
| 46 | 46 | SessionAlert::success('<strong>Your password reset request has been completed.</strong> If the details you have provided match our records, you should receive an email shortly.'); |
| 47 | 47 | |
| 48 | 48 | $this->redirect('login'); |
| 49 | - } |
|
| 50 | - else { |
|
| 49 | + } else { |
|
| 51 | 50 | $this->assignCSRFToken(); |
| 52 | 51 | $this->setTemplate('forgot-password/forgotpw.tpl'); |
| 53 | 52 | } |
@@ -130,8 +129,7 @@ discard block |
||
| 130 | 129 | |
| 131 | 130 | return; |
| 132 | 131 | } |
| 133 | - } |
|
| 134 | - else { |
|
| 132 | + } else { |
|
| 135 | 133 | $this->assignCSRFToken(); |
| 136 | 134 | $this->assign('user', $user); |
| 137 | 135 | $this->setTemplate('forgot-password/forgotpwreset.tpl'); |
@@ -46,8 +46,7 @@ |
||
| 46 | 46 | SessionAlert::success("Preferences updated!"); |
| 47 | 47 | |
| 48 | 48 | $this->redirect(''); |
| 49 | - } |
|
| 50 | - else { |
|
| 49 | + } else { |
|
| 51 | 50 | $this->assignCSRFToken(); |
| 52 | 51 | $this->setTemplate('preferences/prefs.tpl'); |
| 53 | 52 | $this->assign("enforceOAuth", $enforceOAuth); |
@@ -94,13 +94,11 @@ discard block |
||
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | $this->redirect('multiFactor'); |
| 97 | - } |
|
| 98 | - else { |
|
| 97 | + } else { |
|
| 99 | 98 | SessionAlert::error('Error enabling YubiKey OTP - invalid credentials.'); |
| 100 | 99 | $this->redirect('multiFactor'); |
| 101 | 100 | } |
| 102 | - } |
|
| 103 | - else { |
|
| 101 | + } else { |
|
| 104 | 102 | if ($otpCredentialProvider->userIsEnrolled($currentUser->getId())) { |
| 105 | 103 | // user is not enrolled, we shouldn't have got here. |
| 106 | 104 | throw new ApplicationLogicException('User is already enrolled in the selected MFA mechanism'); |
@@ -162,8 +160,7 @@ discard block |
||
| 162 | 160 | $this->setTemplate('mfa/enableTotpEnroll.tpl'); |
| 163 | 161 | |
| 164 | 162 | return; |
| 165 | - } |
|
| 166 | - else { |
|
| 163 | + } else { |
|
| 167 | 164 | SessionAlert::error('Error enabling TOTP - invalid credentials.'); |
| 168 | 165 | $this->redirect('multiFactor'); |
| 169 | 166 | |
@@ -188,8 +185,7 @@ discard block |
||
| 188 | 185 | $this->setTemplate('mfa/regenScratchTokens.tpl'); |
| 189 | 186 | return; |
| 190 | 187 | } |
| 191 | - } |
|
| 192 | - else { |
|
| 188 | + } else { |
|
| 193 | 189 | $otpCredentialProvider->deleteCredential($currentUser); |
| 194 | 190 | SessionAlert::error('Error enabling TOTP: invalid token provided'); |
| 195 | 191 | } |
@@ -197,8 +193,7 @@ discard block |
||
| 197 | 193 | |
| 198 | 194 | $this->redirect('multiFactor'); |
| 199 | 195 | return; |
| 200 | - } |
|
| 201 | - else { |
|
| 196 | + } else { |
|
| 202 | 197 | SessionAlert::error('Error enabling TOTP - no enrollment found or enrollment expired.'); |
| 203 | 198 | $this->redirect('multiFactor'); |
| 204 | 199 | |
@@ -208,8 +203,7 @@ discard block |
||
| 208 | 203 | |
| 209 | 204 | // urgh, dunno what happened, but it's not something expected. |
| 210 | 205 | throw new ApplicationLogicException(); |
| 211 | - } |
|
| 212 | - else { |
|
| 206 | + } else { |
|
| 213 | 207 | if ($otpCredentialProvider->userIsEnrolled($currentUser->getId())) { |
| 214 | 208 | // user is not enrolled, we shouldn't have got here. |
| 215 | 209 | throw new ApplicationLogicException('User is already enrolled in the selected MFA mechanism'); |
@@ -236,7 +230,8 @@ discard block |
||
| 236 | 230 | $this->deleteCredential($database, $currentUser, $otpCredentialProvider, $factorType); |
| 237 | 231 | } |
| 238 | 232 | |
| 239 | - protected function enableU2F() { |
|
| 233 | + protected function enableU2F() |
|
| 234 | + { |
|
| 240 | 235 | $database = $this->getDatabase(); |
| 241 | 236 | $currentUser = User::getCurrent($database); |
| 242 | 237 | |
@@ -289,8 +284,7 @@ discard block |
||
| 289 | 284 | $this->setTemplate('mfa/enableU2FEnroll.tpl'); |
| 290 | 285 | |
| 291 | 286 | return; |
| 292 | - } |
|
| 293 | - else { |
|
| 287 | + } else { |
|
| 294 | 288 | SessionAlert::error('Error enabling TOTP - invalid credentials.'); |
| 295 | 289 | $this->redirect('multiFactor'); |
| 296 | 290 | |
@@ -320,8 +314,7 @@ discard block |
||
| 320 | 314 | |
| 321 | 315 | $this->redirect('multiFactor'); |
| 322 | 316 | return; |
| 323 | - } |
|
| 324 | - else { |
|
| 317 | + } else { |
|
| 325 | 318 | SessionAlert::error('Error enabling TOTP - no enrollment found or enrollment expired.'); |
| 326 | 319 | $this->redirect('multiFactor'); |
| 327 | 320 | |
@@ -331,8 +324,7 @@ discard block |
||
| 331 | 324 | |
| 332 | 325 | // urgh, dunno what happened, but it's not something expected. |
| 333 | 326 | throw new ApplicationLogicException(); |
| 334 | - } |
|
| 335 | - else { |
|
| 327 | + } else { |
|
| 336 | 328 | if ($otpCredentialProvider->userIsEnrolled($currentUser->getId())) { |
| 337 | 329 | // user is not enrolled, we shouldn't have got here. |
| 338 | 330 | throw new ApplicationLogicException('User is already enrolled in the selected MFA mechanism'); |
@@ -347,7 +339,8 @@ discard block |
||
| 347 | 339 | } |
| 348 | 340 | } |
| 349 | 341 | |
| 350 | - protected function disableU2F() { |
|
| 342 | + protected function disableU2F() |
|
| 343 | + { |
|
| 351 | 344 | $database = $this->getDatabase(); |
| 352 | 345 | $currentUser = User::getCurrent($database); |
| 353 | 346 | |
@@ -381,13 +374,11 @@ discard block |
||
| 381 | 374 | $tokens = $otpCredentialProvider->getTokens(); |
| 382 | 375 | $this->assign('tokens', $tokens); |
| 383 | 376 | $this->setTemplate('mfa/regenScratchTokens.tpl'); |
| 384 | - } |
|
| 385 | - else { |
|
| 377 | + } else { |
|
| 386 | 378 | SessionAlert::error('Error refreshing scratch tokens - invalid credentials.'); |
| 387 | 379 | $this->redirect('multiFactor'); |
| 388 | 380 | } |
| 389 | - } |
|
| 390 | - else { |
|
| 381 | + } else { |
|
| 391 | 382 | $this->assignCSRFToken(); |
| 392 | 383 | |
| 393 | 384 | $this->assign('alertmessage', 'To regenerate your emergency scratch tokens, please prove you are who you say you are by providing the information below. Note that continuing will invalidate all remaining scratch tokens, and provide a set of new ones.'); |
@@ -425,13 +416,11 @@ discard block |
||
| 425 | 416 | $otpCredentialProvider->deleteCredential($currentUser); |
| 426 | 417 | SessionAlert::success('Disabled ' . $factorType . '.'); |
| 427 | 418 | $this->redirect('multiFactor'); |
| 428 | - } |
|
| 429 | - else { |
|
| 419 | + } else { |
|
| 430 | 420 | SessionAlert::error('Error disabling ' . $factorType . ' - invalid credentials.'); |
| 431 | 421 | $this->redirect('multiFactor'); |
| 432 | 422 | } |
| 433 | - } |
|
| 434 | - else { |
|
| 423 | + } else { |
|
| 435 | 424 | if (!$otpCredentialProvider->userIsEnrolled($currentUser->getId())) { |
| 436 | 425 | // user is not enrolled, we shouldn't have got here. |
| 437 | 426 | throw new ApplicationLogicException('User is not enrolled in the selected MFA mechanism'); |
@@ -53,8 +53,7 @@ discard block |
||
| 53 | 53 | $this->setTemplate($this->getRegistrationTemplate()); |
| 54 | 54 | $this->addJs("/vendor/dropbox/zxcvbn/dist/zxcvbn.js"); |
| 55 | 55 | } |
| 56 | - } |
|
| 57 | - else { |
|
| 56 | + } else { |
|
| 58 | 57 | $this->assignCSRFToken(); |
| 59 | 58 | $this->assign("useOAuthSignup", $useOAuthSignup); |
| 60 | 59 | $this->setTemplate($this->getRegistrationTemplate()); |
@@ -214,8 +213,7 @@ discard block |
||
| 214 | 213 | $authoriseUrl = $oauth->getRequestToken(); |
| 215 | 214 | WebRequest::setOAuthPartialLogin($user); |
| 216 | 215 | $this->redirectUrl($authoriseUrl); |
| 217 | - } |
|
| 218 | - else { |
|
| 216 | + } else { |
|
| 219 | 217 | // only notify if we're not using the oauth signup. |
| 220 | 218 | $this->getNotificationHelper()->userNew($user); |
| 221 | 219 | WebRequest::setLoggedInUser($user); |
@@ -116,7 +116,8 @@ discard block |
||
| 116 | 116 | $job->setDatabase($database); |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - $this->getTypeAheadHelper()->defineTypeAheadSource('username-typeahead', function() use ($database) { |
|
| 119 | + $this->getTypeAheadHelper()->defineTypeAheadSource('username-typeahead', function() use ($database) |
|
| 120 | + { |
|
| 120 | 121 | return UserSearchHelper::get($database)->fetchColumn('username'); |
| 121 | 122 | }); |
| 122 | 123 | |
@@ -158,8 +159,7 @@ discard block |
||
| 158 | 159 | ->byObjectId($job->getId())->getRecordCount($logCount)->fetch(); |
| 159 | 160 | if ($logCount === 0) { |
| 160 | 161 | $this->assign('log', array()); |
| 161 | - } |
|
| 162 | - else { |
|
| 162 | + } else { |
|
| 163 | 163 | list($users, $logData) = LogHelper::prepareLogsForTemplate($logs, $database, $this->getSiteConfiguration()); |
| 164 | 164 | |
| 165 | 165 | $this->assign("log", $logData); |
@@ -38,7 +38,8 @@ |
||
| 38 | 38 | $requestList->requests = $requests; |
| 39 | 39 | |
| 40 | 40 | $userIds = array_map( |
| 41 | - function(Request $entry) { |
|
| 41 | + function(Request $entry) |
|
| 42 | + { |
|
| 42 | 43 | return $entry->getReserved(); |
| 43 | 44 | }, |
| 44 | 45 | $requests |
@@ -70,12 +70,10 @@ discard block |
||
| 70 | 70 | $userinfoResult = $this->callApi(array('action' => 'query', 'meta' => 'userinfo'), 'GET'); |
| 71 | 71 | if (isset($userinfoResult->query->userinfo->anon)) { |
| 72 | 72 | throw new MediaWikiApiException('Unable to log in.'); |
| 73 | - } |
|
| 74 | - else { |
|
| 73 | + } else { |
|
| 75 | 74 | $this->knownLoggedIn = true; |
| 76 | 75 | } |
| 77 | - } |
|
| 78 | - else { |
|
| 76 | + } else { |
|
| 79 | 77 | $this->knownLoggedIn = true; |
| 80 | 78 | } |
| 81 | 79 | } |
@@ -94,11 +92,9 @@ discard block |
||
| 94 | 92 | |
| 95 | 93 | if ($method == 'GET') { |
| 96 | 94 | $data = $this->httpHelper->get($this->mediawikiWebServiceEndpoint, $apiParams); |
| 97 | - } |
|
| 98 | - elseif ($method == 'POST') { |
|
| 95 | + } elseif ($method == 'POST') { |
|
| 99 | 96 | $data = $this->httpHelper->post($this->mediawikiWebServiceEndpoint, $apiParams); |
| 100 | - } |
|
| 101 | - else { |
|
| 97 | + } else { |
|
| 102 | 98 | throw new ApplicationLogicException('Unsupported HTTP Method'); |
| 103 | 99 | } |
| 104 | 100 | |
@@ -141,7 +137,7 @@ discard block |
||
| 141 | 137 | |
| 142 | 138 | $loginResponse = $this->callApi($params, 'POST'); |
| 143 | 139 | |
| 144 | - if($loginResponse->login->result == 'Success'){ |
|
| 140 | + if($loginResponse->login->result == 'Success') { |
|
| 145 | 141 | return; |
| 146 | 142 | } |
| 147 | 143 | |
@@ -228,8 +228,7 @@ discard block |
||
| 228 | 228 | foreach ($req->fields as $name => $data) { |
| 229 | 229 | if ($data->type === 'checkbox') { |
| 230 | 230 | $checkboxFields[] = $name; |
| 231 | - } |
|
| 232 | - else { |
|
| 231 | + } else { |
|
| 233 | 232 | $requiredFields[] = $name; |
| 234 | 233 | } |
| 235 | 234 | } |
@@ -241,7 +240,8 @@ discard block |
||
| 241 | 240 | * @param string $username |
| 242 | 241 | * @return bool |
| 243 | 242 | */ |
| 244 | - public function checkAccountExists($username) { |
|
| 243 | + public function checkAccountExists($username) |
|
| 244 | + { |
|
| 245 | 245 | $parameters = array( |
| 246 | 246 | 'action' => 'query', |
| 247 | 247 | 'list' => 'users', |