@@ -10,9 +10,9 @@ |
||
| 10 | 10 | |
| 11 | 11 | use DateTimeImmutable; |
| 12 | 12 | use Exception; |
| 13 | -use stdClass; |
|
| 14 | 13 | use Waca\DataObject; |
| 15 | 14 | use Waca\Exceptions\OptimisticLockFailedException; |
| 15 | +use stdClass; |
|
| 16 | 16 | |
| 17 | 17 | class OAuthIdentity extends DataObject |
| 18 | 18 | { |
@@ -14,8 +14,8 @@ |
||
| 14 | 14 | use Waca\DataObjects\Request; |
| 15 | 15 | use Waca\DataObjects\User; |
| 16 | 16 | use Waca\Exceptions\ApplicationLogicException; |
| 17 | -use Waca\Helpers\Logger; |
|
| 18 | 17 | use Waca\Helpers\LogHelper; |
| 18 | +use Waca\Helpers\Logger; |
|
| 19 | 19 | use Waca\Helpers\SearchHelpers\JobQueueSearchHelper; |
| 20 | 20 | use Waca\Helpers\SearchHelpers\LogSearchHelper; |
| 21 | 21 | use Waca\Helpers\SearchHelpers\RequestSearchHelper; |
@@ -144,7 +144,7 @@ |
||
| 144 | 144 | throw new ApplicationLogicException('Could not find requested job'); |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - $this->setHtmlTitle('Job #' . $job->getId()); |
|
| 147 | + $this->setHtmlTitle('Job #'.$job->getId()); |
|
| 148 | 148 | |
| 149 | 149 | $this->prepareMaps(); |
| 150 | 150 | |
@@ -15,27 +15,20 @@ discard block |
||
| 15 | 15 | use Waca\Pages\PageEmailManagement; |
| 16 | 16 | use Waca\Pages\PageExpandedRequestList; |
| 17 | 17 | use Waca\Pages\PageJobQueue; |
| 18 | -use Waca\Pages\RequestAction\PageCreateRequest; |
|
| 19 | -use Waca\Pages\UserAuth\PageChangePassword; |
|
| 20 | -use Waca\Pages\UserAuth\PageForgotPassword; |
|
| 21 | 18 | use Waca\Pages\PageLog; |
| 22 | -use Waca\Pages\UserAuth\PageLogin; |
|
| 23 | -use Waca\Pages\UserAuth\PageLogout; |
|
| 24 | 19 | use Waca\Pages\PageMain; |
| 25 | -use Waca\Pages\UserAuth\PageOAuth; |
|
| 26 | -use Waca\Pages\UserAuth\PageOAuthCallback; |
|
| 27 | -use Waca\Pages\UserAuth\PagePreferences; |
|
| 28 | -use Waca\Pages\Registration\PageRegisterStandard; |
|
| 29 | -use Waca\Pages\Registration\PageRegisterOption; |
|
| 30 | 20 | use Waca\Pages\PageSearch; |
| 31 | 21 | use Waca\Pages\PageSiteNotice; |
| 32 | 22 | use Waca\Pages\PageTeam; |
| 33 | 23 | use Waca\Pages\PageUserManagement; |
| 34 | 24 | use Waca\Pages\PageViewRequest; |
| 35 | 25 | use Waca\Pages\PageWelcomeTemplateManagement; |
| 26 | +use Waca\Pages\Registration\PageRegisterOption; |
|
| 27 | +use Waca\Pages\Registration\PageRegisterStandard; |
|
| 36 | 28 | use Waca\Pages\RequestAction\PageBreakReservation; |
| 37 | 29 | use Waca\Pages\RequestAction\PageCloseRequest; |
| 38 | 30 | use Waca\Pages\RequestAction\PageComment; |
| 31 | +use Waca\Pages\RequestAction\PageCreateRequest; |
|
| 39 | 32 | use Waca\Pages\RequestAction\PageCustomClose; |
| 40 | 33 | use Waca\Pages\RequestAction\PageDeferRequest; |
| 41 | 34 | use Waca\Pages\RequestAction\PageDropRequest; |
@@ -49,6 +42,13 @@ discard block |
||
| 49 | 42 | use Waca\Pages\Statistics\StatsTemplateStats; |
| 50 | 43 | use Waca\Pages\Statistics\StatsTopCreators; |
| 51 | 44 | use Waca\Pages\Statistics\StatsUsers; |
| 45 | +use Waca\Pages\UserAuth\PageChangePassword; |
|
| 46 | +use Waca\Pages\UserAuth\PageForgotPassword; |
|
| 47 | +use Waca\Pages\UserAuth\PageLogin; |
|
| 48 | +use Waca\Pages\UserAuth\PageLogout; |
|
| 49 | +use Waca\Pages\UserAuth\PageOAuth; |
|
| 50 | +use Waca\Pages\UserAuth\PageOAuthCallback; |
|
| 51 | +use Waca\Pages\UserAuth\PagePreferences; |
|
| 52 | 52 | use Waca\Tasks\IRoutedTask; |
| 53 | 53 | use Waca\WebRequest; |
| 54 | 54 | |
@@ -14,7 +14,6 @@ |
||
| 14 | 14 | use Waca\PdoDatabase; |
| 15 | 15 | use Waca\Security\CredentialProviders\ICredentialProvider; |
| 16 | 16 | use Waca\Security\CredentialProviders\PasswordCredentialProvider; |
| 17 | -use Waca\Security\CredentialProviders\YubikeyCredentialProvider; |
|
| 18 | 17 | use Waca\SiteConfiguration; |
| 19 | 18 | |
| 20 | 19 | class AuthenticationManager |
@@ -16,10 +16,6 @@ discard block |
||
| 16 | 16 | use Waca\Pages\PageJobQueue; |
| 17 | 17 | use Waca\Pages\PageLog; |
| 18 | 18 | use Waca\Pages\PageMain; |
| 19 | -use Waca\Pages\RequestAction\PageCreateRequest; |
|
| 20 | -use Waca\Pages\UserAuth\PageChangePassword; |
|
| 21 | -use Waca\Pages\UserAuth\PageOAuth; |
|
| 22 | -use Waca\Pages\UserAuth\PagePreferences; |
|
| 23 | 19 | use Waca\Pages\PageSearch; |
| 24 | 20 | use Waca\Pages\PageSiteNotice; |
| 25 | 21 | use Waca\Pages\PageTeam; |
@@ -29,6 +25,7 @@ discard block |
||
| 29 | 25 | use Waca\Pages\RequestAction\PageBreakReservation; |
| 30 | 26 | use Waca\Pages\RequestAction\PageCloseRequest; |
| 31 | 27 | use Waca\Pages\RequestAction\PageComment; |
| 28 | +use Waca\Pages\RequestAction\PageCreateRequest; |
|
| 32 | 29 | use Waca\Pages\RequestAction\PageCustomClose; |
| 33 | 30 | use Waca\Pages\RequestAction\PageDeferRequest; |
| 34 | 31 | use Waca\Pages\RequestAction\PageDropRequest; |
@@ -42,6 +39,9 @@ discard block |
||
| 42 | 39 | use Waca\Pages\Statistics\StatsTemplateStats; |
| 43 | 40 | use Waca\Pages\Statistics\StatsTopCreators; |
| 44 | 41 | use Waca\Pages\Statistics\StatsUsers; |
| 42 | +use Waca\Pages\UserAuth\PageChangePassword; |
|
| 43 | +use Waca\Pages\UserAuth\PageOAuth; |
|
| 44 | +use Waca\Pages\UserAuth\PagePreferences; |
|
| 45 | 45 | |
| 46 | 46 | class RoleConfiguration |
| 47 | 47 | { |
@@ -24,19 +24,19 @@ discard block |
||
| 24 | 24 | public function authenticate(User $user, $data) |
| 25 | 25 | { |
| 26 | 26 | $storedData = $this->getCredentialData($user->getId()); |
| 27 | - if($storedData === null) |
|
| 27 | + if ($storedData === null) |
|
| 28 | 28 | { |
| 29 | 29 | // No available credential matching these parameters |
| 30 | 30 | return false; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - if($storedData->getVersion() !== 2) { |
|
| 33 | + if ($storedData->getVersion() !== 2) { |
|
| 34 | 34 | // Non-2 versions are not supported. |
| 35 | 35 | return false; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - if(password_verify($data, $storedData->getData())) { |
|
| 39 | - if(password_needs_rehash($storedData->getData(), PASSWORD_BCRYPT, array('cost' => self::PASSWORD_COST))){ |
|
| 38 | + if (password_verify($data, $storedData->getData())) { |
|
| 39 | + if (password_needs_rehash($storedData->getData(), PASSWORD_BCRYPT, array('cost' => self::PASSWORD_COST))) { |
|
| 40 | 40 | $this->setCredential($user, $storedData->getFactor(), $data); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | { |
| 51 | 51 | $storedData = $this->getCredentialData($user->getId()); |
| 52 | 52 | |
| 53 | - if($storedData === null){ |
|
| 53 | + if ($storedData === null) { |
|
| 54 | 54 | $storedData = $this->createNewCredential($user); |
| 55 | 55 | } |
| 56 | 56 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | if ($data === false) { |
| 107 | - throw new CurlException('Curl error: ' . $this->httpHelper->getError()); |
|
| 107 | + throw new CurlException('Curl error: '.$this->httpHelper->getError()); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | $result = json_decode($data); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $response = $this->callApi($tokenParams, 'POST'); |
| 125 | 125 | |
| 126 | 126 | if (isset($response->error)) { |
| 127 | - throw new MediaWikiApiException($response->error->code . ': ' . $response->error->info); |
|
| 127 | + throw new MediaWikiApiException($response->error->code.': '.$response->error->info); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | $token = $response->query->tokens->logintoken; |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | $loginResponse = $this->callApi($params, 'POST'); |
| 144 | 144 | |
| 145 | - if($loginResponse->login->result == 'Success'){ |
|
| 145 | + if ($loginResponse->login->result == 'Success') { |
|
| 146 | 146 | return; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | curl_setopt($this->curlHandle, CURLOPT_SSL_VERIFYPEER, false); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - if($cookieJar !== null) { |
|
| 36 | + if ($cookieJar !== null) { |
|
| 37 | 37 | curl_setopt($this->curlHandle, CURLOPT_COOKIEFILE, $cookieJar); |
| 38 | 38 | curl_setopt($this->curlHandle, CURLOPT_COOKIEJAR, $cookieJar); |
| 39 | 39 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | public function get($url, $parameters = null, $headers = array()) |
| 60 | 60 | { |
| 61 | 61 | if ($parameters !== null && is_array($parameters)) { |
| 62 | - $getString = '?' . http_build_query($parameters); |
|
| 62 | + $getString = '?'.http_build_query($parameters); |
|
| 63 | 63 | $url .= $getString; |
| 64 | 64 | } |
| 65 | 65 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | if ($result === false) { |
| 76 | 76 | $error = curl_error($this->curlHandle); |
| 77 | - throw new CurlException('Remote request failed with error ' . $error); |
|
| 77 | + throw new CurlException('Remote request failed with error '.$error); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | return $result; |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | if ($result === false) { |
| 106 | 106 | $error = curl_error($this->curlHandle); |
| 107 | - throw new CurlException('Remote request failed with error ' . $error); |
|
| 107 | + throw new CurlException('Remote request failed with error '.$error); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | return $result; |
@@ -58,12 +58,12 @@ discard block |
||
| 58 | 58 | $response = $this->mediaWikiClient->doApiCall($tokenParams, 'POST'); |
| 59 | 59 | |
| 60 | 60 | if (isset($response->error)) { |
| 61 | - throw new MediaWikiApiException($response->error->code . ': ' . $response->error->info); |
|
| 61 | + throw new MediaWikiApiException($response->error->code.': '.$response->error->info); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | $token = $response->query->tokens->createaccounttoken; |
| 65 | 65 | |
| 66 | - $callback = $this->siteConfiguration->getBaseUrl() . '/internal.php/oauth/createCallback'; |
|
| 66 | + $callback = $this->siteConfiguration->getBaseUrl().'/internal.php/oauth/createCallback'; |
|
| 67 | 67 | |
| 68 | 68 | $checkboxFields = array(); |
| 69 | 69 | $requiredFields = array(); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | $createResponse = $this->mediaWikiClient->doApiCall($createParams, 'POST'); |
| 87 | 87 | |
| 88 | 88 | if (isset($createResponse->error)) { |
| 89 | - throw new MediaWikiApiException($response->error->code . ': ' . $response->error->info); |
|
| 89 | + throw new MediaWikiApiException($response->error->code.': '.$response->error->info); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | if (!isset($createResponse->createaccount) || !isset($createResponse->createaccount->status)) { |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | return; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - throw new Exception('API result reported status of ' . $createResponse->createaccount->status); |
|
| 105 | + throw new Exception('API result reported status of '.$createResponse->createaccount->status); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | $response = $this->mediaWikiClient->doApiCall($tokenParams, 'POST'); |
| 127 | 127 | |
| 128 | 128 | if (isset($response->error)) { |
| 129 | - throw new MediaWikiApiException($response->error->code . ': ' . $response->error->info); |
|
| 129 | + throw new MediaWikiApiException($response->error->code.': '.$response->error->info); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | $token = $response->query->tokens->csrftoken; |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | $editParameters = array( |
| 139 | 139 | 'action' => 'edit', |
| 140 | - 'title' => 'User talk:' . $username, |
|
| 140 | + 'title' => 'User talk:'.$username, |
|
| 141 | 141 | 'section' => 'new', |
| 142 | 142 | 'sectiontitle' => $title, |
| 143 | 143 | 'summary' => $summary, |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | if (!isset($response->edit)) { |
| 155 | 155 | if (isset($response->error)) { |
| 156 | - throw new MediaWikiApiException($response->error->code . ': ' . $response->error->info); |
|
| 156 | + throw new MediaWikiApiException($response->error->code.': '.$response->error->info); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | throw new MediaWikiApiException('Unknown error encountered during editing.'); |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | return; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - throw new MediaWikiApiException('Edit status unsuccessful: ' . $editResponse->result); |
|
| 167 | + throw new MediaWikiApiException('Edit status unsuccessful: '.$editResponse->result); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | public function getCreationFieldData(&$requiredFields, &$czechboxFields) |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | $response = $this->mediaWikiClient->doApiCall($params, 'GET'); |
| 180 | 180 | |
| 181 | 181 | if (isset($response->error)) { |
| 182 | - throw new MediaWikiApiException($response->error->code . ': ' . $response->error->info); |
|
| 182 | + throw new MediaWikiApiException($response->error->code.': '.$response->error->info); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | $requests = $response->query->authmanagerinfo->requests; |