devise 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of devise might be problematic. Click here for more details.

@@ -1,3 +1,9 @@
1
+ == 1.0.4
2
+
3
+ * bug fix
4
+ * Fixed a bug when deleting an account with rememberable
5
+ * Fixed a bug with custom controllers
6
+
1
7
  == 1.0.3
2
8
 
3
9
  * enhancements
@@ -22,9 +22,11 @@ end
22
22
  # Before logout hook to forget the user in the given scope, only if rememberable
23
23
  # is activated for this scope. Also clear remember token to ensure the user
24
24
  # won't be remembered again.
25
+ # Notice that we forget the user if the record is frozen. This usually means the
26
+ # user was just deleted.
25
27
  Warden::Manager.before_logout do |record, warden, scope|
26
28
  if record.respond_to?(:forget_me!)
27
- record.forget_me!
29
+ record.forget_me! unless record.frozen?
28
30
  warden.response.delete_cookie "remember_#{scope}_token"
29
31
  end
30
32
  end
@@ -9,12 +9,13 @@ module Devise
9
9
  # * :null - When true, allow columns to be null.
10
10
  # * :encryptor - The encryptor going to be used, necessary for setting the proper encrypter password length.
11
11
  def authenticatable(options={})
12
- null = options[:null] || false
13
- encryptor = options[:encryptor] || (respond_to?(:encryptor) ? self.encryptor : :sha1)
12
+ null = options[:null] || false
13
+ default = options[:default]
14
+ encryptor = options[:encryptor] || (respond_to?(:encryptor) ? self.encryptor : :sha1)
14
15
 
15
- apply_schema :email, String, :null => null
16
- apply_schema :encrypted_password, String, :null => null, :limit => Devise::ENCRYPTORS_LENGTH[encryptor]
17
- apply_schema :password_salt, String, :null => null
16
+ apply_schema :email, String, :null => null, :default => default
17
+ apply_schema :encrypted_password, String, :null => null, :default => default, :limit => Devise::ENCRYPTORS_LENGTH[encryptor]
18
+ apply_schema :password_salt, String, :null => null, :default => default
18
19
  end
19
20
 
20
21
  # Creates authentication_token.
@@ -23,7 +23,7 @@ module Devise
23
23
  protected
24
24
 
25
25
  def valid_controller?
26
- params[:controller] == 'sessions'
26
+ params[:controller] =~ /sessions$/
27
27
  end
28
28
 
29
29
  def valid_params?
@@ -1,3 +1,3 @@
1
1
  module Devise
2
- VERSION = "1.0.3".freeze
2
+ VERSION = "1.0.4".freeze
3
3
  end
@@ -216,7 +216,7 @@ class ConfirmableTest < ActiveSupport::TestCase
216
216
  Devise.confirm_within = 0.days
217
217
  user = create_user
218
218
  user.confirmation_sent_at = Date.today
219
- assert_not user.active?
219
+ assert_not user.reload.active?
220
220
  end
221
221
 
222
222
  test 'should not be active without confirmation' do
@@ -1,9 +1,13 @@
1
1
  class Admin
2
2
  include MongoMapper::Document
3
-
4
- devise :authenticatable, :timeoutable
3
+ devise :authenticatable, :registerable, :timeoutable
5
4
 
6
5
  def self.find_for_authentication(conditions)
7
- last(:conditions => conditions, :order => "email")
6
+ last(:conditions => conditions)
7
+ end
8
+
9
+ def self.last(options={})
10
+ options.merge!(:order => 'email')
11
+ super options
8
12
  end
9
13
  end
@@ -1,8 +1,14 @@
1
1
  class User
2
2
  include MongoMapper::Document
3
3
  key :created_at, DateTime
4
- devise :authenticatable, :http_authenticatable, :confirmable, :recoverable,
5
- :rememberable, :trackable, :validatable, :timeoutable, :lockable,
6
- :token_authenticatable
4
+ devise :authenticatable, :http_authenticatable, :confirmable, :lockable, :recoverable,
5
+ :registerable, :rememberable, :timeoutable, :token_authenticatable,
6
+ :trackable, :validatable
7
7
  # attr_accessible :username, :email, :password, :password_confirmation
8
+
9
+ def self.last(options={})
10
+ options.merge!(:order => 'email')
11
+ super options
12
+ end
13
+
8
14
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Jos\xC3\xA9 Valim"
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2010-02-23 00:00:00 +01:00
13
+ date: 2010-03-03 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency