Warning: Undefined variable $namespace in /home/net1/social.net1.club/vendor/symfony/maker-bundle/src/Resources/skeleton/forgottenPassword/PasswordResetToken.tpl.php on line 3
; use Doctrine\ORM\Mapping as ORM; /** * @ORM\Entity(repositoryClass="
Warning: Undefined variable $repository_class_name in /home/net1/social.net1.club/vendor/symfony/maker-bundle/src/Resources/skeleton/forgottenPassword/PasswordResetToken.tpl.php on line 8
") */ class
Warning: Undefined variable $class_name in /home/net1/social.net1.club/vendor/symfony/maker-bundle/src/Resources/skeleton/forgottenPassword/PasswordResetToken.tpl.php on line 10
{ const LIFETIME_HOURS = 24; const SELECTOR_LENGTH = 20; // in chars /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string") */ private $selector; /** * @ORM\Column(type="string") */ private $token; /** * @ORM\Column(type="datetime_immutable") */ private $requestedAt; /** * @ORM\ManyToOne(targetEntity="
Warning: Undefined variable $user_full_class_name in /home/net1/social.net1.club/vendor/symfony/maker-bundle/src/Resources/skeleton/forgottenPassword/PasswordResetToken.tpl.php on line 39
") */ private $user; private $plainToken; public function __construct(User $user) { $this->requestedAt = new \DateTimeImmutable('now'); $this->selector = strtr(base64_encode(random_bytes(self::SELECTOR_LENGTH * 3 / 4)), '+/', '-_'); $this->plainToken = strtr(base64_encode(random_bytes(18)), '+/', '-_'); $this->token = password_hash($this->plainToken, PASSWORD_DEFAULT); $this->user = $user; } public function getId() { return $this->id; } public function getAsString(): string { if (!$this->selector || !$this->plainToken) { throw new \Exception('You can get PasswordResetToken as a string only immediately after creation.'); } return $this->selector.$this->plainToken; } public function getUser():
Warning: Undefined variable $user_class_name in /home/net1/social.net1.club/vendor/symfony/maker-bundle/src/Resources/skeleton/forgottenPassword/PasswordResetToken.tpl.php on line 68
{ return $this->user; } public function isTokenEquals(string $token): bool { return password_verify($token, $this->token); } public function isExpired(): bool { if (($this->requestedAt->getTimestamp() + self::LIFETIME_HOURS * 3600) <= time()) { return true; } return false; } }