* * @param string $token * @param string $password * @return RedirectResponse|TemplateResponse */
(string $token, string $password = '')
| 173 | * @return RedirectResponse|TemplateResponse |
| 174 | */ |
| 175 | #[PublicPage] |
| 176 | #[NoCSRFRequired] |
| 177 | #[UseSession] |
| 178 | #[BruteForceProtection(action: 'analyticsPublicSharePassword')] |
| 179 | #[AnonRateLimit(limit: 10, period: 60)] |
| 180 | public function authenticatePassword(string $token, string $password = '') |
| 181 | { |
| 182 | $share = $this->ShareService->getReportByToken($token); |
| 183 | if (empty($share)) { |
| 184 | return $this->redirectToLogin($token); |
| 185 | } |
| 186 | if ($share['password'] === null || $this->ShareService->verifyPassword($password, $share['password'])) { |
| 187 | if ($share['password'] !== null) { |
| 188 | $this->DataSession->setShareAuthenticated($token, $share['password']); |
| 189 | } |
| 190 | return new RedirectResponse($this->urlGenerator->linkToRoute($this->appName . '.page.indexPublic', ['token' => $token])); |
| 191 | } |
| 192 | |
| 193 | $this->DataSession->removeShareAuthentication($token); |
| 194 | $response = $this->passwordPrompt($token, true); |
| 195 | $response->throttle(['action' => 'analyticsPublicSharePassword', 'token' => hash('sha256', $token)]); |
| 196 | return $response; |
| 197 | } |
| 198 | |
| 199 | /** |
| 200 | * @param $token |
nothing calls this directly
no test coverage detected