From fdfe6a834034512822edf359bc78622457a5d2ee Mon Sep 17 00:00:00 2001 From: Alexander Dreher Date: Thu, 21 Apr 2011 18:10:21 +0800 Subject: [PATCH] Fixes error on missing reset_password_sent_at column. If the column is not present, you are unabled to reset your password. --- lib/devise/models/recoverable.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/devise/models/recoverable.rb b/lib/devise/models/recoverable.rb index a4bb7a6a..d444a36e 100644 --- a/lib/devise/models/recoverable.rb +++ b/lib/devise/models/recoverable.rb @@ -42,6 +42,7 @@ module Devise # Checks if the reset password token sent is within the limit time. # We do this by calculating if the difference between today and the # sending date does not exceed the confirm in time configured. + # Returns true if the ressource is not responding to reset_password_sent_at at all. # reset_password_within is a model configuration, must always be an integer value. # # Example: @@ -59,7 +60,8 @@ module Devise # reset_password_period_valid? # will always return false # def reset_password_period_valid? - respond_to?(:reset_password_sent_at) && reset_password_sent_at && + return true unless respond_to?(:reset_password_sent_at) + reset_password_sent_at && reset_password_sent_at.utc >= self.class.reset_password_within.ago end