@@ -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; |
@@ -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,8 +24,7 @@ discard block |
||
| 24 | 24 | public function authenticate(User $user, $data) |
| 25 | 25 | { |
| 26 | 26 | $storedData = $this->getCredentialData($user->getId()); |
| 27 | - if($storedData === null) |
|
| 28 | - { |
|
| 27 | + if($storedData === null) { |
|
| 29 | 28 | // No available credential matching these parameters |
| 30 | 29 | return false; |
| 31 | 30 | } |
@@ -36,7 +35,7 @@ discard block |
||
| 36 | 35 | } |
| 37 | 36 | |
| 38 | 37 | if(password_verify($data, $storedData->getData())) { |
| 39 | - if(password_needs_rehash($storedData->getData(), PASSWORD_BCRYPT, array('cost' => self::PASSWORD_COST))){ |
|
| 38 | + if(password_needs_rehash($storedData->getData(), PASSWORD_BCRYPT, array('cost' => self::PASSWORD_COST))) { |
|
| 40 | 39 | $this->setCredential($user, $storedData->getFactor(), $data); |
| 41 | 40 | } |
| 42 | 41 | |
@@ -50,7 +49,7 @@ discard block |
||
| 50 | 49 | { |
| 51 | 50 | $storedData = $this->getCredentialData($user->getId()); |
| 52 | 51 | |
| 53 | - if($storedData === null){ |
|
| 52 | + if($storedData === null) { |
|
| 54 | 53 | $storedData = $this->createNewCredential($user); |
| 55 | 54 | } |
| 56 | 55 | |
@@ -142,7 +142,7 @@ |
||
| 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 | |
@@ -241,7 +241,8 @@ |
||
| 241 | 241 | * @param string $username |
| 242 | 242 | * @return bool |
| 243 | 243 | */ |
| 244 | - public function checkAccountExists($username) { |
|
| 244 | + public function checkAccountExists($username) |
|
| 245 | + { |
|
| 245 | 246 | $parameters = array( |
| 246 | 247 | 'action' => 'query', |
| 247 | 248 | 'list' => 'users', |
@@ -23,7 +23,8 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return JobQueueSearchHelper |
| 25 | 25 | */ |
| 26 | - public static function get(PdoDatabase $database) { |
|
| 26 | + public static function get(PdoDatabase $database) |
|
| 27 | + { |
|
| 27 | 28 | $helper = new JobQueueSearchHelper($database); |
| 28 | 29 | return $helper; |
| 29 | 30 | } |
@@ -33,7 +34,8 @@ discard block |
||
| 33 | 34 | * |
| 34 | 35 | * @return $this |
| 35 | 36 | */ |
| 36 | - public function statusIn($statuses) { |
|
| 37 | + public function statusIn($statuses) |
|
| 38 | + { |
|
| 37 | 39 | $this->inClause('status', $statuses); |
| 38 | 40 | |
| 39 | 41 | return $this; |
@@ -42,27 +44,31 @@ discard block |
||
| 42 | 44 | /** |
| 43 | 45 | * @return $this |
| 44 | 46 | */ |
| 45 | - public function notAcknowledged() { |
|
| 47 | + public function notAcknowledged() |
|
| 48 | + { |
|
| 46 | 49 | $this->whereClause .= ' AND (acknowledged IS NULL OR acknowledged = 0)'; |
| 47 | 50 | |
| 48 | 51 | return $this; |
| 49 | 52 | } |
| 50 | 53 | |
| 51 | - public function byTask($task) { |
|
| 54 | + public function byTask($task) |
|
| 55 | + { |
|
| 52 | 56 | $this->whereClause .= ' AND task = ?'; |
| 53 | 57 | $this->parameterList[] = $task; |
| 54 | 58 | |
| 55 | 59 | return $this; |
| 56 | 60 | } |
| 57 | 61 | |
| 58 | - public function byUser($userId) { |
|
| 62 | + public function byUser($userId) |
|
| 63 | + { |
|
| 59 | 64 | $this->whereClause .= ' AND user = ?'; |
| 60 | 65 | $this->parameterList[] = $userId; |
| 61 | 66 | |
| 62 | 67 | return $this; |
| 63 | 68 | } |
| 64 | 69 | |
| 65 | - public function byStatus($status) { |
|
| 70 | + public function byStatus($status) |
|
| 71 | + { |
|
| 66 | 72 | $this->whereClause .= ' AND status = ?'; |
| 67 | 73 | $this->parameterList[] = $status; |
| 68 | 74 | |