public function withUser() { $user = $this->entity->getUser(); if ($user !== null) { $this->entityDTO->user = $this->dtoBuilderFactory->getUserDTOBuilder($user)->build(); } return $this; }
/** * @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; } }
public function requestPasswordResetToken($email, $userAgent, $ip4) { $user = $this->userRepository->findOneByEmail($email); $userToken = UserToken::createResetPasswordToken($user, UserToken::getRandomToken(), $userAgent, $ip4); $this->createUserToken($userToken); }
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')))); }