Making sure timeoutable respects rememberable if both are loaded.

This commit is contained in:
Pat Allan
2010-09-29 12:21:07 +08:00
committed by José Valim
parent fbb77a6edd
commit 16c39a9f17
2 changed files with 21 additions and 2 deletions

View File

@@ -22,9 +22,19 @@ module Devise
# Checks whether the user session has expired based on configured time.
def timedout?(last_access)
return false if remember_exists_and_not_expired?
last_access && last_access <= self.class.timeout_in.ago
end
private
def remember_exists_and_not_expired?
return false unless respond_to?(:remember_expired?)
remember_created_at && !remember_expired?
end
module ClassMethods
Devise::Models.config(self, :timeout_in)
end