public function withUser()
 {
     $user = $this->entity->getUser();
     if ($user !== null) {
         $this->entityDTO->user = $this->dtoBuilderFactory->getUserDTOBuilder($user)->build();
     }
     return $this;
 }
Example #2
0
 /**
  * @param UserLoginResultType $result
  * @param string $email
  * @param string $ip4
  * @param User|null $user
  * @param UserToken|null $userToken
  */
 public function __construct(UserLoginResultType $result, $email, $ip4, User $user = null, UserToken $userToken = null)
 {
     $this->setId();
     $this->setCreated();
     $this->result = $result;
     $this->email = (string) $email;
     $this->ip4 = (int) ip2long($ip4);
     if ($user !== null) {
         $user->addUserLogin($this);
         $this->user = $user;
     }
     if ($userToken !== null) {
         $userToken->addUserLogin($this);
         $this->userToken = $userToken;
     }
 }
Example #3
0
 public function requestPasswordResetToken($email, $userAgent, $ip4)
 {
     $user = $this->userRepository->findOneByEmail($email);
     $userToken = UserToken::createResetPasswordToken($user, UserToken::getRandomToken(), $userAgent, $ip4);
     $this->createUserToken($userToken);
 }
Example #4
0
 public function testVerifyTokenDateValid()
 {
     $this->assertFalse($this->userToken->verifyTokenDateValid());
     $this->assertFalse($this->userToken->verifyTokenDateValid(new DateTime('2016-10-22', new DateTimeZone('UTC'))));
     $this->assertTrue($this->userToken->verifyTokenDateValid(new DateTime('2014-10-22', new DateTimeZone('UTC'))));
 }