Skip to content

Commit 0c981f1

Browse files
committed
add ability to generate a fake reset token
1 parent 3040f3d commit 0c981f1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Controller/ResetPasswordControllerTrait.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,13 @@ 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+
}
93102
}

0 commit comments

Comments
 (0)