Skip to content

Commit b98f491

Browse files
committed
Merge pull request mongodb#1903 from azizramdan/master
Fix Convert UTCDateTime to a date string when reset password
2 parents 2f564ce + 5255b99 commit b98f491

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/Jenssegers/Mongodb/Auth/DatabaseTokenRepository.php

+18-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,23 @@ protected function getPayload($email, $token)
2525
* @inheritdoc
2626
*/
2727
protected function tokenExpired($createdAt)
28+
{
29+
$createdAt = $this->convertDateTime($createdAt);
30+
31+
return parent::tokenExpired($createdAt);
32+
}
33+
34+
/**
35+
* @inheritdoc
36+
*/
37+
protected function tokenRecentlyCreated($createdAt)
38+
{
39+
$createdAt = $this->convertDateTime($createdAt);
40+
41+
return parent::tokenRecentlyCreated($createdAt);
42+
}
43+
44+
private function convertDateTime($createdAt)
2845
{
2946
// Convert UTCDateTime to a date string.
3047
if ($createdAt instanceof UTCDateTime) {
@@ -37,6 +54,6 @@ protected function tokenExpired($createdAt)
3754
$createdAt = $date->format('Y-m-d H:i:s');
3855
}
3956

40-
return parent::tokenExpired($createdAt);
57+
return $createdAt;
4158
}
4259
}

0 commit comments

Comments
 (0)