Skip to content

Commit a665aad

Browse files
Merge pull request heartcombo#4461 from jjuliano/patch-1
Confirmation link validity is wrong in different time zone
2 parents 0c5d78e + a3d3177 commit a665aad

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Attempt to reset password without the password field in the request now results in a `:blank` validation error.
88
Before this change, Devise would accept the reset password request and log the user in, without validating/changing
99
the password. (by @victor-am)
10+
* Confirmation links now expire based on UTC time, working properly when using different timezones. (by @jjuliano)
1011
* enhancements
1112
* Notify the original email when it is changed with a new `Devise.send_email_changed_notification` setting.
1213
When using `reconfirmable`, the notification will be sent right away instead of when the unconfirmed email is confirmed.

lib/devise/models/confirmable.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def confirmation_period_valid?
225225
# confirmation_period_expired? # will always return false
226226
#
227227
def confirmation_period_expired?
228-
self.class.confirm_within && self.confirmation_sent_at && (Time.now > self.confirmation_sent_at + self.class.confirm_within)
228+
self.class.confirm_within && self.confirmation_sent_at && (Time.now.utc > self.confirmation_sent_at + self.class.confirm_within)
229229
end
230230

231231
# Checks whether the record requires any confirmation.

0 commit comments

Comments
 (0)