@@ -19,11 +19,11 @@ discard block |
||
| 19 | 19 | class Application extends App implements IBootstrap { |
| 20 | 20 | public const APP_ID = 'twofactor_gateway'; |
| 21 | 21 | |
| 22 | - public function __construct(array $urlParams = []) { |
|
| 22 | + public function __construct(array $urlParams = [ ]) { |
|
| 23 | 23 | parent::__construct(self::APP_ID, $urlParams); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - #[\Override] |
|
| 26 | + #[\Override ] |
|
| 27 | 27 | public function register(IRegistrationContext $context): void { |
| 28 | 28 | $providerFactory = Server::get(Factory::class); |
| 29 | 29 | $fqcn = $providerFactory->getFqcnList(); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - #[\Override] |
|
| 35 | + #[\Override ] |
|
| 36 | 36 | public function boot(IBootContext $context): void { |
| 37 | 37 | } |
| 38 | 38 | } |
@@ -13,12 +13,12 @@ |
||
| 13 | 13 | |
| 14 | 14 | class Provider extends AProvider { |
| 15 | 15 | |
| 16 | - #[\Override] |
|
| 16 | + #[\Override ] |
|
| 17 | 17 | public function getDisplayName(): string { |
| 18 | 18 | return $this->l10n->t('Signal verification'); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - #[\Override] |
|
| 21 | + #[\Override ] |
|
| 22 | 22 | public function getDescription(): string { |
| 23 | 23 | return $this->l10n->t('Authenticate via Signal'); |
| 24 | 24 | } |
@@ -13,12 +13,12 @@ |
||
| 13 | 13 | |
| 14 | 14 | class Provider extends AProvider { |
| 15 | 15 | |
| 16 | - #[\Override] |
|
| 16 | + #[\Override ] |
|
| 17 | 17 | public function getDisplayName(): string { |
| 18 | 18 | return $this->l10n->t('Message gateway verification'); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - #[\Override] |
|
| 21 | + #[\Override ] |
|
| 22 | 22 | public function getDescription(): string { |
| 23 | 23 | return $this->l10n->t('Authenticate via SMS'); |
| 24 | 24 | } |
@@ -13,12 +13,12 @@ |
||
| 13 | 13 | |
| 14 | 14 | class Provider extends AProvider { |
| 15 | 15 | |
| 16 | - #[\Override] |
|
| 16 | + #[\Override ] |
|
| 17 | 17 | public function getDisplayName(): string { |
| 18 | 18 | return $this->l10n->t('XMPP verification'); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - #[\Override] |
|
| 21 | + #[\Override ] |
|
| 22 | 22 | public function getDescription(): string { |
| 23 | 23 | return $this->l10n->t('Authenticate via XMPP'); |
| 24 | 24 | } |
@@ -13,12 +13,12 @@ |
||
| 13 | 13 | |
| 14 | 14 | class Provider extends AProvider { |
| 15 | 15 | |
| 16 | - #[\Override] |
|
| 16 | + #[\Override ] |
|
| 17 | 17 | public function getDisplayName(): string { |
| 18 | 18 | return $this->l10n->t('WhatsApp verification'); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - #[\Override] |
|
| 21 | + #[\Override ] |
|
| 22 | 22 | public function getDescription(): string { |
| 23 | 23 | return $this->l10n->t('Authenticate via WhatsApp'); |
| 24 | 24 | } |
@@ -13,12 +13,12 @@ |
||
| 13 | 13 | |
| 14 | 14 | class Provider extends AProvider { |
| 15 | 15 | |
| 16 | - #[\Override] |
|
| 16 | + #[\Override ] |
|
| 17 | 17 | public function getDisplayName(): string { |
| 18 | 18 | return $this->l10n->t('Telegram verification'); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - #[\Override] |
|
| 21 | + #[\Override ] |
|
| 22 | 22 | public function getDescription(): string { |
| 23 | 23 | return $this->l10n->t('Authenticate via Telegram'); |
| 24 | 24 | } |
@@ -82,7 +82,7 @@ |
||
| 82 | 82 | return $this->verificationCode; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - #[\Override] |
|
| 85 | + #[\Override ] |
|
| 86 | 86 | public function jsonSerialize(): mixed { |
| 87 | 87 | return [ |
| 88 | 88 | 'gatewayName' => $this->gatewayName, |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * SPDX-FileCopyrightText: 2024 Christoph Wurst <[email protected]> |
@@ -43,17 +43,17 @@ discard block |
||
| 43 | 43 | * 400: User not found |
| 44 | 44 | * 503: Gateway wasn't configured yed |
| 45 | 45 | */ |
| 46 | - #[NoAdminRequired] |
|
| 47 | - #[ApiRoute(verb: 'GET', url: '/settings/{gateway}/verification')] |
|
| 46 | + #[NoAdminRequired ] |
|
| 47 | + #[ApiRoute(verb: 'GET', url: '/settings/{gateway}/verification') ] |
|
| 48 | 48 | public function getVerificationState(string $gateway): JSONResponse { |
| 49 | 49 | $user = $this->userSession->getUser(); |
| 50 | 50 | |
| 51 | 51 | if (is_null($user)) { |
| 52 | - return new JSONResponse(['message' => 'User not found'], Http::STATUS_BAD_REQUEST); |
|
| 52 | + return new JSONResponse([ 'message' => 'User not found' ], Http::STATUS_BAD_REQUEST); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | if (!$this->gatewayFactory->get($gateway)->isComplete()) { |
| 56 | - return new JSONResponse([], Http::STATUS_SERVICE_UNAVAILABLE); |
|
| 56 | + return new JSONResponse([ ], Http::STATUS_SERVICE_UNAVAILABLE); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | return new JSONResponse($this->setup->getState($user, $gateway)->jsonSerialize()); |
@@ -70,19 +70,19 @@ discard block |
||
| 70 | 70 | * 200: OK |
| 71 | 71 | * 400: User not found |
| 72 | 72 | */ |
| 73 | - #[NoAdminRequired] |
|
| 74 | - #[ApiRoute(verb: 'POST', url: '/settings/{gateway}/verification/start')] |
|
| 73 | + #[NoAdminRequired ] |
|
| 74 | + #[ApiRoute(verb: 'POST', url: '/settings/{gateway}/verification/start') ] |
|
| 75 | 75 | public function startVerification(string $gateway, string $identifier): JSONResponse { |
| 76 | 76 | $user = $this->userSession->getUser(); |
| 77 | 77 | |
| 78 | 78 | if (is_null($user)) { |
| 79 | - return new JSONResponse(['message' => 'User not found'], Http::STATUS_BAD_REQUEST); |
|
| 79 | + return new JSONResponse([ 'message' => 'User not found' ], Http::STATUS_BAD_REQUEST); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | try { |
| 83 | 83 | $state = $this->setup->startSetup($user, $gateway, $identifier); |
| 84 | 84 | } catch (VerificationException $e) { |
| 85 | - return new JSONResponse(['message' => $e->getMessage()], Http::STATUS_BAD_REQUEST); |
|
| 85 | + return new JSONResponse([ 'message' => $e->getMessage() ], Http::STATUS_BAD_REQUEST); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | return new JSONResponse([ |
@@ -101,22 +101,22 @@ discard block |
||
| 101 | 101 | * 200: OK |
| 102 | 102 | * 400: User not found |
| 103 | 103 | */ |
| 104 | - #[NoAdminRequired] |
|
| 105 | - #[ApiRoute(verb: 'POST', url: '/settings/{gateway}/verification/finish')] |
|
| 104 | + #[NoAdminRequired ] |
|
| 105 | + #[ApiRoute(verb: 'POST', url: '/settings/{gateway}/verification/finish') ] |
|
| 106 | 106 | public function finishVerification(string $gateway, string $verificationCode): JSONResponse { |
| 107 | 107 | $user = $this->userSession->getUser(); |
| 108 | 108 | |
| 109 | 109 | if (is_null($user)) { |
| 110 | - return new JSONResponse(['message' => 'User not found'], Http::STATUS_BAD_REQUEST); |
|
| 110 | + return new JSONResponse([ 'message' => 'User not found' ], Http::STATUS_BAD_REQUEST); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | try { |
| 114 | 114 | $this->setup->finishSetup($user, $gateway, $verificationCode); |
| 115 | 115 | } catch (VerificationException) { |
| 116 | - return new JSONResponse([], Http::STATUS_BAD_REQUEST); |
|
| 116 | + return new JSONResponse([ ], Http::STATUS_BAD_REQUEST); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - return new JSONResponse([]); |
|
| 119 | + return new JSONResponse([ ]); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -128,13 +128,13 @@ discard block |
||
| 128 | 128 | * 200: OK |
| 129 | 129 | * 400: User not found |
| 130 | 130 | */ |
| 131 | - #[NoAdminRequired] |
|
| 132 | - #[ApiRoute(verb: 'DELETE', url: '/settings/{gateway}/verification')] |
|
| 131 | + #[NoAdminRequired ] |
|
| 132 | + #[ApiRoute(verb: 'DELETE', url: '/settings/{gateway}/verification') ] |
|
| 133 | 133 | public function revokeVerification(string $gateway): JSONResponse { |
| 134 | 134 | $user = $this->userSession->getUser(); |
| 135 | 135 | |
| 136 | 136 | if (is_null($user)) { |
| 137 | - return new JSONResponse(['message' => 'User not found'], Http::STATUS_BAD_REQUEST); |
|
| 137 | + return new JSONResponse([ 'message' => 'User not found' ], Http::STATUS_BAD_REQUEST); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | return new JSONResponse($this->setup->disable($user, $gateway)); |