1 | <?php |
||
19 | class EmailUpdateConfirmation implements EmailUpdateConfirmationInterface |
||
20 | { |
||
21 | const EMAIL_CONFIRMED = 'email_confirmed'; |
||
22 | |||
23 | private $mailer; |
||
24 | private $router; |
||
25 | private $tokenGenerator; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | private $encryptionMode; |
||
31 | |||
32 | /** |
||
33 | * @var ValidatorInterface |
||
34 | */ |
||
35 | private $validator; |
||
36 | |||
37 | /** |
||
38 | * @var string Route for confirmation link |
||
39 | */ |
||
40 | private $confirmationRoute = 'user_update_email_confirm'; |
||
41 | private $eventDispatcher; |
||
42 | private $redirectRoute; |
||
43 | |||
44 | public function __construct( |
||
65 | |||
66 | /** |
||
67 | * Get $mailer. |
||
68 | * |
||
69 | * @return MailerInterface |
||
70 | */ |
||
71 | public function getMailer() |
||
75 | |||
76 | /** |
||
77 | * Generate new confirmation link for new email based on user confirmation |
||
78 | * token and hashed new user email. |
||
79 | * |
||
80 | * @param Request $request |
||
81 | * |
||
82 | * @return string |
||
83 | */ |
||
84 | public function generateConfirmationLink(Request $request, UserInterface $user, $email) |
||
113 | |||
114 | /** |
||
115 | * Fetch email value from hashed part of confirmation link. |
||
116 | * @param UserInterface $user |
||
117 | * @param string $hashedEmail |
||
118 | * |
||
119 | * @return string Encrypted email |
||
120 | */ |
||
121 | public function fetchEncryptedEmailFromConfirmationLink($user, $hashedEmail) |
||
130 | |||
131 | /** |
||
132 | * Get token which indicates that email was confirmed. |
||
133 | * |
||
134 | * @return string |
||
135 | */ |
||
136 | public function getEmailConfirmedToken() |
||
140 | |||
141 | /** |
||
142 | * Return IV size. |
||
143 | * |
||
144 | * @return int |
||
145 | */ |
||
146 | protected function getIvSize() |
||
150 | |||
151 | /** |
||
152 | * Encrypt email value with specified user confirmation token. |
||
153 | * |
||
154 | * @return string Encrypted email |
||
155 | */ |
||
156 | public function encryptEmailValue($userConfirmationToken, $email) |
||
178 | |||
179 | /** |
||
180 | * Decrypt email value with specified user confirmation token. |
||
181 | * @param string $userConfirmationToken |
||
182 | * @param string $encryptedEmail |
||
183 | * |
||
184 | * @return string Decrypted email |
||
185 | */ |
||
186 | public function decryptEmailValue($userConfirmationToken, $encryptedEmail) |
||
216 | } |
||
217 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: