Compare commits

...

5 Commits
v1.4 ... v1.3.2

Author SHA1 Message Date
José Valim
76edb49c9d Release 1.3.2. 2011-04-21 13:59:40 +02:00
José Valim
b7d86ac014 Add tests to previous commit.
Conflicts:

	Gemfile.lock
2011-04-21 13:57:09 +02:00
Alexander Dreher
7097189de1 Fixes error on missing reset_password_sent_at column.
If the column is not present, you are unabled to reset your password.
2011-04-21 13:56:29 +02:00
José Valim
c4e451b896 Merge branch 'master' into v1.3
Conflicts:
	test/integration/authenticatable_test.rb
2011-04-19 10:41:17 +02:00
José Valim
fd6ba32812 to_json does not guarantee the order. 2011-04-18 13:03:22 +02:00
5 changed files with 17 additions and 4 deletions

View File

@@ -1,3 +1,8 @@
== 1.3.2
* bug fix
* Fix another regression related to reset_password_sent_at (by github.com/alexdreher)
== 1.3.1
* enhancements

View File

@@ -1,7 +1,7 @@
PATH
remote: .
specs:
devise (1.3.0)
devise (1.3.1)
bcrypt-ruby (~> 2.1.2)
orm_adapter (~> 0.0.3)
warden (~> 1.0.3)

View File

@@ -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,8 +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 &&
reset_password_sent_at.utc >= self.class.reset_password_within.ago
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
protected

View File

@@ -1,3 +1,3 @@
module Devise
VERSION = "1.3.1".freeze
VERSION = "1.3.2".freeze
end

View File

@@ -204,4 +204,11 @@ class RecoverableTest < ActiveSupport::TestCase
user.reload
assert_not_nil user.reset_password_token
end
test 'should have valid period if does not respond to reset_password_sent_at' do
user = create_user
user.stubs(:respond_to?).with(:reset_password_sent_at).returns(false)
assert user.reset_password_period_valid?
end
end