mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-09 23:58:06 -05:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d36e1012f8 | ||
|
|
5d187ff278 | ||
|
|
a0220243c3 | ||
|
|
4c10f86e74 | ||
|
|
cf66e935a9 | ||
|
|
fbe485f3df |
@@ -1,3 +1,9 @@
|
||||
== 1.0.4
|
||||
|
||||
* bug fix
|
||||
* Fixed a bug when deleting an account with rememberable
|
||||
* Fixed a bug with custom controllers
|
||||
|
||||
== 1.0.3
|
||||
|
||||
* enhancements
|
||||
|
||||
2
Rakefile
2
Rakefile
@@ -44,7 +44,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}/**/*", "rails/init.rb"]
|
||||
s.add_dependency("warden", "~> 0.9.3")
|
||||
s.add_dependency("warden", "~> 0.9.4")
|
||||
end
|
||||
|
||||
Jeweler::GemcutterTasks.new
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
s.name = %q{devise}
|
||||
s.version = "1.0.3"
|
||||
s.version = "1.0.4"
|
||||
|
||||
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||||
s.authors = ["Jos\303\251 Valim", "Carlos Ant\303\264nio"]
|
||||
s.date = %q{2010-02-23}
|
||||
s.date = %q{2010-03-03}
|
||||
s.description = %q{Flexible authentication solution for Rails with Warden}
|
||||
s.email = %q{contact@plataformatec.com.br}
|
||||
s.extra_rdoc_files = [
|
||||
@@ -168,12 +168,12 @@ Gem::Specification.new do |s|
|
||||
s.specification_version = 3
|
||||
|
||||
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
||||
s.add_runtime_dependency(%q<warden>, ["~> 0.9.3"])
|
||||
s.add_runtime_dependency(%q<warden>, ["~> 0.9.4"])
|
||||
else
|
||||
s.add_dependency(%q<warden>, ["~> 0.9.3"])
|
||||
s.add_dependency(%q<warden>, ["~> 0.9.4"])
|
||||
end
|
||||
else
|
||||
s.add_dependency(%q<warden>, ["~> 0.9.3"])
|
||||
s.add_dependency(%q<warden>, ["~> 0.9.4"])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -22,9 +22,11 @@ end
|
||||
# Before logout hook to forget the user in the given scope, only if rememberable
|
||||
# is activated for this scope. Also clear remember token to ensure the user
|
||||
# won't be remembered again.
|
||||
# Notice that we forget the user if the record is frozen. This usually means the
|
||||
# user was just deleted.
|
||||
Warden::Manager.before_logout do |record, warden, scope|
|
||||
if record.respond_to?(:forget_me!)
|
||||
record.forget_me!
|
||||
record.forget_me! unless record.frozen?
|
||||
warden.response.delete_cookie "remember_#{scope}_token"
|
||||
end
|
||||
end
|
||||
@@ -9,12 +9,13 @@ module Devise
|
||||
# * :null - When true, allow columns to be null.
|
||||
# * :encryptor - The encryptor going to be used, necessary for setting the proper encrypter password length.
|
||||
def authenticatable(options={})
|
||||
null = options[:null] || false
|
||||
encryptor = options[:encryptor] || (respond_to?(:encryptor) ? self.encryptor : :sha1)
|
||||
null = options[:null] || false
|
||||
default = options[:default]
|
||||
encryptor = options[:encryptor] || (respond_to?(:encryptor) ? self.encryptor : :sha1)
|
||||
|
||||
apply_schema :email, String, :null => null
|
||||
apply_schema :encrypted_password, String, :null => null, :limit => Devise::ENCRYPTORS_LENGTH[encryptor]
|
||||
apply_schema :password_salt, String, :null => null
|
||||
apply_schema :email, String, :null => null, :default => default
|
||||
apply_schema :encrypted_password, String, :null => null, :default => default, :limit => Devise::ENCRYPTORS_LENGTH[encryptor]
|
||||
apply_schema :password_salt, String, :null => null, :default => default
|
||||
end
|
||||
|
||||
# Creates authentication_token.
|
||||
|
||||
@@ -23,7 +23,7 @@ module Devise
|
||||
protected
|
||||
|
||||
def valid_controller?
|
||||
params[:controller] == 'sessions'
|
||||
params[:controller] =~ /sessions$/
|
||||
end
|
||||
|
||||
def valid_params?
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module Devise
|
||||
VERSION = "1.0.3".freeze
|
||||
VERSION = "1.0.4".freeze
|
||||
end
|
||||
|
||||
@@ -28,6 +28,14 @@ class RememberMeTest < ActionController::IntegrationTest
|
||||
assert warden.user(:user) == user
|
||||
end
|
||||
|
||||
test 'does not remember other scopes' do
|
||||
user = create_user_and_remember
|
||||
get root_path
|
||||
assert_response :success
|
||||
assert warden.authenticated?(:user)
|
||||
assert_not warden.authenticated?(:admin)
|
||||
end
|
||||
|
||||
test 'do not remember with invalid token' do
|
||||
user = create_user_and_remember('add')
|
||||
get users_path
|
||||
|
||||
@@ -216,7 +216,7 @@ class ConfirmableTest < ActiveSupport::TestCase
|
||||
Devise.confirm_within = 0.days
|
||||
user = create_user
|
||||
user.confirmation_sent_at = Date.today
|
||||
assert_not user.active?
|
||||
assert_not user.reload.active?
|
||||
end
|
||||
|
||||
test 'should not be active without confirmation' do
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
class Admin
|
||||
include MongoMapper::Document
|
||||
|
||||
devise :authenticatable, :timeoutable
|
||||
devise :authenticatable, :registerable, :timeoutable
|
||||
|
||||
def self.find_for_authentication(conditions)
|
||||
last(:conditions => conditions, :order => "email")
|
||||
last(:conditions => conditions)
|
||||
end
|
||||
|
||||
def self.last(options={})
|
||||
options.merge!(:order => 'email')
|
||||
super options
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
class User
|
||||
include MongoMapper::Document
|
||||
key :created_at, DateTime
|
||||
devise :authenticatable, :http_authenticatable, :confirmable, :recoverable,
|
||||
:rememberable, :trackable, :validatable, :timeoutable, :lockable,
|
||||
:token_authenticatable
|
||||
devise :authenticatable, :http_authenticatable, :confirmable, :lockable, :recoverable,
|
||||
:registerable, :rememberable, :timeoutable, :token_authenticatable,
|
||||
:trackable, :validatable
|
||||
# attr_accessible :username, :email, :password, :password_confirmation
|
||||
|
||||
def self.last(options={})
|
||||
options.merge!(:order => 'email')
|
||||
super options
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user