Builds a reset password link.

@param int    $userId
@param string $ip
@param string $userAgent

@return UserLink
484085
public function buildLink($userId, $ip, $userAgent)
    {
        $link = new UserLink();
        $link->user_id = $userId;
        $link->type = UserLink::FORGOT_PASSWORD;

        try {
            $link->save();
        } catch (\Exception $e) {
            throw new \Exception("Could not create reset password link for user # $userId: ".$e->getMessage());
        }

        // record the reset password request event
        $event = new AccountSecurityEvent();
        $event->user_id = $userId;
        $event->type = AccountSecurityEvent::RESET_PASSWORD_REQUEST;
        $event->ip = $ip;
        $event->user_agent = $userAgent;
        $event->save();

        return $link;
    }
656966
public static function userAgentStart($userAgent)
    {

        $mobile_ua = strtolower(substr($userAgent, 0, 4));

        return (in_array($mobile_ua, self::$_uaBegin));
    }
785167
public function createLinkToken($userId)
    {
        $url = sprintf('%s/v2/bot/user/%s/linkToken', $this->endpointBase, urlencode($userId));
        return $this->httpClient->post($url, []);
    }
490526
public static function create($userId, string $secret, int $expiration, string $issuer): string
    {
        $builder = self::builder();

        return $builder->setPayloadClaim('user_id', $userId)
            ->setSecret($secret)
            ->setExpiration($expiration)
            ->setIssuer($issuer)
            ->setIssuedAt(time())
            ->build()
            ->getToken();
    }
438692
public function filter($userAgent, $deviceID)
    {
        Utils::reset();

        $genericNormalizer = UserAgentHandlerChainFactory::createGenericNormalizers();
        $userAgent         = $genericNormalizer->normalize($userAgent);

        $handlers = $this->getHandlers();

        foreach ($handlers as $handler) {
            /** @var $handler \Wurfl\Handlers\AbstractHandler */
            $handler->setLogger($this->logger);

            if ($handler->filter($userAgent, $deviceID)) {
                break;
            }
        }
    }
97425
public function setUserAgent($userAgent)
    {
        if ($this->userAgent != $userAgent) {
            $this->reset();
        }
        $this->userAgent = $userAgent;
    }
24716
protected function commonCurlParams($url,$userAgent)
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_PORT, 443);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

        if (!is_null($this->config['cabundle_file'])) {
            curl_setopt($ch, CURLOPT_CAINFO, $this->config['cabundle_file']);
        }

        if (!empty($userAgent))
            curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);

        if ($this->config['proxy_host'] != null && $this->config['proxy_port'] != -1) {
            curl_setopt($ch, CURLOPT_PROXY, $this->config['proxy_host'] . ':' . $this->config['proxy_port']);
        }

        if ($this->config['proxy_username'] != null && $this->config['proxy_password'] != null) {
            curl_setopt($ch, CURLOPT_PROXYUSERPWD, $this->config['proxy_username'] . ':' . $this->config['proxy_password']);
        }

        return $ch;
    }
1009844
public function deleteUser($userId)
    {
        try {
            return $this->innerGateway->deleteUser($userId);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
1111838
public function applyConclusiveMatch($userAgent) {
		$deviceId = WURFL_Constants::GENERIC;
		if (WURFL_Handlers_Utils::checkIfStartsWith($userAgent, 'Mozilla')) {
			$deviceId = $this->applyMozillaConclusiveMatch($userAgent);
		} else {
			$tolerance = WURFL_Handlers_Utils::firstSlash($userAgent);
			$deviceId = $this->getDeviceIDFromRIS($userAgent, $tolerance);
		}
		
		return $deviceId;
	}
583858
public function toOpenId($userId, $agentId)
    {
        $params = [
            'userid'  => $userId,
            'agentid' => $agentId,
        ];

        return $this->parseJSON('json', [self::API_TO_OPENID, $params]);
    }
1206369
public function getById($userId, array $queryParams = [])
    {
        $response = $this->api->users()->getById($userId, $queryParams);

        return new UserResponse($response);
    }
1012395
public function setUserAgent($userAgent)
    {
        if (isset(self::$predefinedUserAgents[$userAgent])) {
            $this->addOption(CURLOPT_USERAGENT, self::$predefinedUserAgents[$userAgent]);
        } else {
            $this->addOption(CURLOPT_USERAGENT, $userAgent);
        }
    }
1237856
public function setUserId( $userId )
    {
        $this->_user    = null;
        $this->userId   = ( (int) $userId ) ?: null;
        return $this;
    }
641959
protected function setUsernameToken($username, $usernameId = null)
    {
        $usernameToken = new UsernameToken($usernameId);
        $usernameToken->setUsername(new Username($username));
        $this->security->setUsernameToken($usernameToken);

        return $this;
    }
203576
public function findForUser($id, $userId)
    {
        return Passport::token()->where('id', $id)->where('user_id', $userId)->first();
    }
78111
public function setSecretAnswer(UserInterface $user, $questionId, $answer)
    {
        $class = $this->entityOptions->getSecretAnswer();
        /** @var \PServerCore\Entity\SecretAnswer $secretAnswer */
        $secretAnswer = new $class;

        $secretAnswer->setUser($user)
            ->setAnswer(trim($answer))
            ->setQuestion($this->getQuestion4Id($questionId));

        $this->entityManager->persist($user);
        $this->entityManager->persist($secretAnswer);
        $this->entityManager->flush();

        return $secretAnswer;
    }
587581
function setUserAgent($useragent = null)
    {
        $this->userAgent = $useragent;
        curl_setopt($this->ch, CURLOPT_USERAGENT, $useragent);
    }