1 | <?php |
||
20 | trait ResetPasswordTrait |
||
21 | { |
||
22 | /** |
||
23 | * @var string Reset token. |
||
24 | * |
||
25 | * @ORM\Column(name="reset_token", type="string", length=32, nullable=true) |
||
26 | */ |
||
27 | protected $resetToken; |
||
28 | |||
29 | /** |
||
30 | * @var int Unix Epoch timestamp when the reset token expires. |
||
31 | * |
||
32 | * @ORM\Column(name="reset_token_expires_at", type="integer", nullable=true) |
||
33 | */ |
||
34 | protected $resetTokenExpiresAt; |
||
35 | |||
36 | /** |
||
37 | * Generates new reset token which expires in specified period of time. |
||
38 | * |
||
39 | * @param \DateInterval $interval |
||
40 | * |
||
41 | * @return string Generated token. |
||
42 | */ |
||
43 | 1 | public function generateResetToken(\DateInterval $interval) |
|
52 | |||
53 | /** |
||
54 | * Clears current reset token. |
||
55 | * |
||
56 | * @return self |
||
57 | */ |
||
58 | 1 | public function clearResetToken() |
|
65 | |||
66 | /** |
||
67 | * Checks whether specified reset token is valid. |
||
68 | * |
||
69 | * @param string $token |
||
70 | * |
||
71 | * @return bool |
||
72 | */ |
||
73 | 1 | public function isResetTokenValid(string $token) |
|
80 | } |
||
81 |