Permalink
Browse files

merged with changes introduced in 0.4.3

  • Loading branch information...
Marcelo Silveira
Marcelo Silveira committed Nov 10, 2009
2 parents 2825998 + e690168 commit 51f633325e8dee3e6147d35893c16c577280f121
View
@@ -1,3 +1,13 @@
+* enhancements
+ * Moved encryption strategy into the Encryptors module to allow several algorithms
+ * Implemented encryptors for Clearance, Authlogic and Restful-Authentication
+
+== 0.4.3
+
+* bug fix
+ * [#29] Authentication fail if user cannot be serialized from session;
+ * Default configuration values should not overwrite user values;
+
== 0.4.2
* deprecations
View
@@ -36,7 +36,7 @@ begin
s.description = "Flexible authentication solution for Rails with Warden"
s.authors = ['José Valim', 'Carlos Antônio']
s.files = FileList["[A-Z]*", "{app,config,generators,lib}/**/*", "init.rb"]
- s.add_dependency("warden", "~> 0.5.1")
+ s.add_dependency("warden", "~> 0.5.2")
end
Jeweler::GemcutterTasks.new
View
@@ -12,17 +12,35 @@ module Devise
TRUE_VALUES = [true, 1, '1', 't', 'T', 'true', 'TRUE'].freeze
# Maps the messages types that comes from warden to a flash type.
+ # This hash is not frozen, so you can add your messages as well.
FLASH_MESSAGES = {
:unauthenticated => :success,
:unconfirmed => :failure
}
- # Models configuration
- mattr_accessor :pepper, :encryptor, :stretches, :remember_for, :confirm_within
+ # Used to encrypt password. Please generate one with rake secret
+ mattr_accessor :pepper
+ @@pepper = nil
+
+ # Used to define the password encryption algorithm
+ mattr_accessor :encryptor
+ @@encryptor = ::Devise::Encryptors::Sha1
+
+ # The number of times to encrypt password.
+ mattr_accessor :stretches
+ @@stretches = 10
+
+ # Time interval where the remember me token is valid.
+ mattr_accessor :remember_for
+ @@remember_for = 2.weeks
+
+ # Time interval you can access your account before confirming your account.
+ mattr_accessor :confirm_within
+ @@confirm_within = 0.days
- # Mappings
+ # Store scopes mappings.
mattr_accessor :mappings
- self.mappings = {}
+ @@mappings = {}
class << self
# Default way to setup Devise. Run script/generate devise_install to create
@@ -76,4 +94,4 @@ def configure_warden_manager(manager) #:nodoc:
end
require 'devise/warden'
-require 'devise/rails'
+require 'devise/rails'
View
@@ -16,9 +16,7 @@ module Models
# To add the class methods you need to have a module ClassMethods defined
# inside the given class.
#
- def self.config(mod, accessor, default=nil) #:nodoc:
- Devise.send :"#{accessor}=", default
-
+ def self.config(mod, accessor) #:nodoc:
mod.class_eval <<-METHOD, __FILE__, __LINE__
def #{accessor}
self.class.#{accessor}
@@ -80,8 +80,8 @@ def find_or_initialize_with_error_by_email(email)
end
Devise::Models.config(self, :pepper)
- Devise::Models.config(self, :stretches, 10)
- Devise::Models.config(self, :encryptor, ::Devise::Encryptors::Sha1)
+ Devise::Models.config(self, :stretches)
+ Devise::Models.config(self, :encryptor)
end
end
end
@@ -150,7 +150,7 @@ def confirm!(attributes={})
end
end
- Devise::Models.config(self, :confirm_within, 0.days)
+ Devise::Models.config(self, :confirm_within)
end
end
end
@@ -89,7 +89,7 @@ def serialize_from_cookie(cookie)
end
end
- Devise::Models.config(self, :remember_for, 2.weeks)
+ Devise::Models.config(self, :remember_for)
end
end
end
View
@@ -1,3 +1,3 @@
module Devise
- VERSION = "0.4.2".freeze
+ VERSION = "0.4.3".freeze
end
View
@@ -13,7 +13,7 @@
# Session Serialization out. This block gets the user out of the session.
# It should be the reverse of serializing the object into the session
Warden::Manager.serialize_from_session do |klass, id|
- klass.find(id)
+ klass.find_by_id(id)
end
# Setup devise strategies for Warden
@@ -184,4 +184,12 @@ class AuthenticationTest < ActionController::IntegrationTest
visit 'users/index'
assert_equal "Cart", @controller.user_session[:cart]
end
+
+ test 'destroyed account is logged out' do
+ sign_in_as_user
+ visit 'users/index'
+ User.destroy_all
+ visit 'users/index'
+ assert_redirected_to '/users/sign_in?unauthenticated=true'
+ end
end

0 comments on commit 51f6333

Please sign in to comment.