SymfonyCasts / reset-password-bundle

Need a killer reset password feature for your Symfony? Us too!
https://symfonycasts.com
MIT License
477 stars 68 forks source link

ResetPasswordToken -> getExpiresAtIntervalInstance() - timezone problem #241

Closed gaetshun closed 2 years ago

gaetshun commented 2 years ago

It seems there is a Timezone problem. In fact, there is a problem when you try to get a DateInterval between createdAt and expireAt.

1- createdAt (generatedAt) is a timestamp and when you try to create the DateTimeImmutable => the timezone used is UTC. 2 - expireAt use the timezone by default on the server (in my case Europe/Paris). this is a problem when you try to make a diff between these two DateTimeInterface.

For me the good solution will be to get resquestedAt variable from passwordResetRequest object for generating the ResetPasswordToken object.

the quick solution would be to put in the function getExpiresAtIntervalInstance() "$createdAtTime=$createdAtTime->setTimezone($this->expiresAt->getTimezone());"

bocharsky-bw commented 2 years ago

Should be fixed by #225, right?

gaetshun commented 2 years ago

Yes exactly, I approved this fix.