Skip to content

Commit 4937355

Browse files
committed
revert fake token getter in controller trait
1 parent 6d772b8 commit 4937355

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/Controller/ResetPasswordControllerTrait.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,4 @@ private function getSessionService(): SessionInterface
9090

9191
return $request->getSession();
9292
}
93-
94-
/**
95-
* Generate a fake token to be used in the session if needed to prevent
96-
* revealing if a user exists.
97-
*/
98-
private function getFakeToken(int $tokenLifetime): ResetPasswordToken
99-
{
100-
return new ResetPasswordToken('fake-token', new \DateTimeImmutable(\sprintf('+%d seconds', $tokenLifetime)), \time());
101-
}
10293
}

src/ResetPasswordHelper.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ public function getTokenLifetime(): int
157157
/**
158158
* Generate a fake reset token.
159159
*
160+
* Use this to generate a fake token so that you can, for example, show a
161+
* "reset confirmation email sent" page that includes a valid "expiration date",
162+
* even if the email was not actually found (and so, a true ResetPasswordToken
163+
* was not actually created).
164+
*
160165
* This method should not be used when timing attacks are a concern.
161166
*/
162167
public function generateFakeResetToken(): ResetPasswordToken

0 commit comments

Comments
 (0)