* * @param string $token * @param string $password * @return RedirectResponse|TemplateResponse */
(string $token, string $password = '')
| 159 | * @return RedirectResponse|TemplateResponse |
| 160 | */ |
| 161 | #[PublicPage] |
| 162 | #[NoCSRFRequired] |
| 163 | #[UseSession] |
| 164 | #[BruteForceProtection(action: 'analyticsPublicSharePassword')] |
| 165 | #[AnonRateLimit(limit: 10, period: 60)] |
| 166 | public function authenticatePassword(string $token, string $password = '') |
| 167 | { |
| 168 | $share = $this->ShareService->getReportByToken($token); |
| 169 | if (empty($share)) { |
| 170 | return $this->redirectToLogin($token); |
| 171 | } |
| 172 | if ($share['password'] === null || $this->ShareService->verifyPassword($password, $share['password'])) { |
| 173 | if ($share['password'] !== null) { |
| 174 | $this->DataSession->setShareAuthenticated($token, $share['password']); |
| 175 | } |
| 176 | return new RedirectResponse($this->urlGenerator->linkToRoute($this->appName . '.page.indexPublic', ['token' => $token])); |
| 177 | } |
| 178 | |
| 179 | $this->DataSession->removeShareAuthentication($token); |
| 180 | $response = $this->passwordPrompt($token, true); |
| 181 | $response->throttle(['action' => 'analyticsPublicSharePassword', 'token' => hash('sha256', $token)]); |
| 182 | return $response; |
| 183 | } |
| 184 | |
| 185 | /** |
| 186 | * @param $token |
nothing calls this directly
no test coverage detected