@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | protected IGateway $gateway; |
38 | 38 | |
39 | 39 | private function getSessionKey(): string { |
40 | - return 'twofactor_gateway_' . $this->getGatewayName() . '_secret'; |
|
40 | + return 'twofactor_gateway_'.$this->getGatewayName().'_secret'; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | public function __construct( |
@@ -58,14 +58,14 @@ discard block |
||
58 | 58 | } |
59 | 59 | $fqcn = static::class; |
60 | 60 | $parts = explode('\\', $fqcn); |
61 | - [$name] = array_slice($parts, -2, 1); |
|
61 | + [ $name ] = array_slice($parts, -2, 1); |
|
62 | 62 | $this->gatewayName = strtolower($name); |
63 | 63 | return $this->gatewayName; |
64 | 64 | } |
65 | 65 | |
66 | - #[\Override] |
|
66 | + #[\Override ] |
|
67 | 67 | public function getId(): string { |
68 | - return 'gateway_' . $this->getGatewayName(); |
|
68 | + return 'gateway_'.$this->getGatewayName(); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | private function getSecret(): string { |
@@ -79,21 +79,21 @@ discard block |
||
79 | 79 | return $secret; |
80 | 80 | } |
81 | 81 | |
82 | - #[\Override] |
|
82 | + #[\Override ] |
|
83 | 83 | public function getTemplate(IUser $user): ITemplate { |
84 | 84 | $secret = $this->getSecret(); |
85 | 85 | |
86 | 86 | try { |
87 | 87 | $identifier = $this->stateStorage->get($user, $this->getGatewayName())->getIdentifier() ?? ''; |
88 | 88 | |
89 | - $message = $this->gateway->getSettings()['allow_markdown'] ?? false |
|
90 | - ? $this->l10n->t('`%s` is your Nextcloud authentication code', [$secret]) |
|
91 | - : $this->l10n->t('%s is your Nextcloud authentication code', [$secret]); |
|
89 | + $message = $this->gateway->getSettings()[ 'allow_markdown' ] ?? false |
|
90 | + ? $this->l10n->t('`%s` is your Nextcloud authentication code', [ $secret ]) |
|
91 | + : $this->l10n->t('%s is your Nextcloud authentication code', [ $secret ]); |
|
92 | 92 | |
93 | 93 | $this->gateway->send( |
94 | 94 | $identifier, |
95 | 95 | $message, |
96 | - ['code' => $secret], |
|
96 | + [ 'code' => $secret ], |
|
97 | 97 | ); |
98 | 98 | } catch (MessageTransmissionException) { |
99 | 99 | return $this->templateManager->getTemplate('twofactor_gateway', 'error'); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | return $tmpl; |
105 | 105 | } |
106 | 106 | |
107 | - #[\Override] |
|
107 | + #[\Override ] |
|
108 | 108 | public function verifyChallenge(IUser $user, string $challenge): bool { |
109 | 109 | $valid = $this->session->exists($this->getSessionKey()) |
110 | 110 | && $this->session->get($this->getSessionKey()) === $challenge; |
@@ -116,31 +116,31 @@ discard block |
||
116 | 116 | return $valid; |
117 | 117 | } |
118 | 118 | |
119 | - #[\Override] |
|
119 | + #[\Override ] |
|
120 | 120 | public function isTwoFactorAuthEnabledForUser(IUser $user): bool { |
121 | 121 | return $this->stateStorage->get($user, $this->getGatewayName())->getState() === StateStorage::STATE_ENABLED; |
122 | 122 | } |
123 | 123 | |
124 | - #[\Override] |
|
124 | + #[\Override ] |
|
125 | 125 | public function getPersonalSettings(IUser $user): IPersonalProviderSettings { |
126 | - $this->initialState->provideInitialState('settings-' . $this->gateway->getProviderId(), $this->gateway->getSettings()); |
|
126 | + $this->initialState->provideInitialState('settings-'.$this->gateway->getProviderId(), $this->gateway->getSettings()); |
|
127 | 127 | return new PersonalSettings( |
128 | 128 | $this->getGatewayName(), |
129 | 129 | $this->gateway->isComplete(), |
130 | 130 | ); |
131 | 131 | } |
132 | 132 | |
133 | - #[\Override] |
|
133 | + #[\Override ] |
|
134 | 134 | public function getLightIcon(): String { |
135 | 135 | return Server::get(IURLGenerator::class)->imagePath(Application::APP_ID, 'app.svg'); |
136 | 136 | } |
137 | 137 | |
138 | - #[\Override] |
|
138 | + #[\Override ] |
|
139 | 139 | public function getDarkIcon(): String { |
140 | 140 | return Server::get(IURLGenerator::class)->imagePath(Application::APP_ID, 'app-dark.svg'); |
141 | 141 | } |
142 | 142 | |
143 | - #[\Override] |
|
143 | + #[\Override ] |
|
144 | 144 | public function disableFor(IUser $user) { |
145 | 145 | $state = $this->stateStorage->get($user, $this->getGatewayName()); |
146 | 146 | if ($state->getState() === StateStorage::STATE_ENABLED) { |