PartKeepr\AuthBundle\Controller\DefaultController::getSaltAction PHP Method

getSaltAction() public method

Retrieves the salt for a given user.
public getSaltAction ( FOS\RestBundle\Request\ParamFetcher $paramFetcher ) : string
$paramFetcher FOS\RestBundle\Request\ParamFetcher
return string The salt
    public function getSaltAction(ParamFetcher $paramFetcher)
    {
        $entityManager = $this->getDoctrine()->getManager();
        /**
         * @var EntityRepository
         */
        $repository = $entityManager->getRepository('PartKeepr\\AuthBundle\\Entity\\FOSUser');
        /**
         * @var FOSUser
         */
        $user = $repository->findOneBy(['username' => $paramFetcher->get('username')]);
        if ($user !== null) {
            return $user->getSalt();
        } else {
            return false;
        }
    }