/** * If you have failed to login too many times, a log of this will be present * in your session and the databse (incase session is dropped the record remains). * * @access public * @return int */ public function vote() { $request = $this->requestStack->getMasterRequest(); if (($this->forceAccountRecovery['enabled'] || $this->blockPages['enabled']) && $request) { $route = $request->get('_route'); $ipAddress = $request->getClientIp(); $this->blockPages['routes'][] = $this->routeLogin['name']; if ($this->blockPages['enabled'] && in_array($route, $this->blockPages['routes'])) { // Get number of failed login attempts. $attempts = $this->loginFailureTracker->getAttempts($ipAddress, $this->blockPages['duration_in_minutes']); if (count($attempts) >= $this->blockPages['after_attempts']) { // You have too many failed login attempts, login access is temporarily blocked. return self::ACCESS_DENIED_BLOCK; } } $this->forceAccountRecovery['routes'][] = $this->routeLogin['name']; if ($this->forceAccountRecovery['enabled'] && in_array($route, $this->forceAccountRecovery['routes'])) { // Get number of failed login attempts. $attempts = $this->loginFailureTracker->getAttempts($ipAddress, $this->forceAccountRecovery['duration_in_minutes']); if (count($attempts) >= $this->forceAccountRecovery['after_attempts']) { // You have too many failed login attempts, login access is temporarily blocked, go recover your account. return self::ACCESS_DENIED_DEFER; } } } return self::ACCESS_ALLOWED; }