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

Method authenticatePassword

lib/Controller/PageController.php:161–183  ·  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

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

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