Skip to content

Commit

Permalink
Merge pull request #4461 from jjuliano/patch-1
Browse files Browse the repository at this point in the history
Confirmation link validity is wrong in different time zone
  • Loading branch information
carlosantoniodasilva committed Mar 15, 2017
2 parents 0c5d78e + a3d3177 commit a665aad
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* Attempt to reset password without the password field in the request now results in a `:blank` validation error.
Before this change, Devise would accept the reset password request and log the user in, without validating/changing
the password. (by @victor-am)
* Confirmation links now expire based on UTC time, working properly when using different timezones. (by @jjuliano)
* enhancements
* Notify the original email when it is changed with a new `Devise.send_email_changed_notification` setting.
When using `reconfirmable`, the notification will be sent right away instead of when the unconfirmed email is confirmed.
Expand Down
2 changes: 1 addition & 1 deletion lib/devise/models/confirmable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def confirmation_period_valid?
# confirmation_period_expired? # will always return false
#
def confirmation_period_expired?
self.class.confirm_within && self.confirmation_sent_at && (Time.now > self.confirmation_sent_at + self.class.confirm_within)
self.class.confirm_within && self.confirmation_sent_at && (Time.now.utc > self.confirmation_sent_at + self.class.confirm_within)
end

# Checks whether the record requires any confirmation.
Expand Down

0 comments on commit a665aad

Please sign in to comment.