MCPcopy Create free account
hub / github.com/Rello/analytics / authenticatePassword

Method authenticatePassword

lib/Controller/PageController.php:175–197  ·  view source on GitHub ↗

* * @param string $token * @param string $password * @return RedirectResponse|TemplateResponse */

(string $token, string $password = '')

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

redirectToLoginMethod · 0.95
passwordPromptMethod · 0.95
verifyPasswordMethod · 0.80
setShareAuthenticatedMethod · 0.80
getReportByTokenMethod · 0.45

Tested by

no test coverage detected