src/Sulu/Bundle/SecurityBundle/Controller/ResettingController.php
private function findUserByValidToken($token)
    {
        try {
            /** @var UserInterface $user */
            $user = $this->getUserRepository()->findUserByToken($token);
            if (new \DateTime() > $user->getPasswordResetTokenExpiresAt()) {
                throw new InvalidTokenException($token);
            }

            return $user;
        } catch (NoResultException $exc) {
            throw new InvalidTokenException($token);
        }
    }
private function findUserByValidToken($token)
    {
        try {
            /** @var UserInterface $user */
            $user = $this->getUserRepository()->findUserByToken($token);
            if (new \DateTime() > $user->getPasswordResetTokenExpiresAt()) {
                throw new InvalidTokenException($token);
            }

            return $user;
        } catch (NoResultException $exc) {
            throw new InvalidTokenException($token);
        }
    }
private function findUserByValidToken ( $ token ) { try { /** @var UserInterface $user */ $ user = $ this -> getUserRepository ( ) -> findUserByToken ( $ token ) ; if ( new \ DateTime ( ) > $ user -> getPasswordResetTokenExpiresAt ( ) ) { throw new InvalidTokenException ( $ token ) ; } return $ user ; } catch ( NoResultException $ exc ) { throw new InvalidTokenException ( $ token ) ; } }
Returns a user for a given token and checks if the token is still valid.

@param string $token

@return \Symfony\Component\Security\Core\User\UserInterface

@throws InvalidTokenException
Returns a user for a given token and checks if the token is still valid .