devise 1.1.9 → 1.2.rc
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.
- data/CHANGELOG.rdoc +34 -26
- data/README.rdoc +134 -100
- data/app/controllers/devise/confirmations_controller.rb +1 -1
- data/app/controllers/devise/omniauth_callbacks_controller.rb +26 -0
- data/app/controllers/devise/passwords_controller.rb +1 -1
- data/app/controllers/devise/registrations_controller.rb +59 -6
- data/app/controllers/devise/sessions_controller.rb +3 -2
- data/app/controllers/devise/unlocks_controller.rb +1 -1
- data/app/helpers/devise_helper.rb +4 -2
- data/app/mailers/devise/mailer.rb +27 -10
- data/app/views/devise/confirmations/new.html.erb +1 -1
- data/app/views/devise/passwords/edit.html.erb +2 -2
- data/app/views/devise/passwords/new.html.erb +1 -1
- data/app/views/devise/registrations/edit.html.erb +1 -1
- data/app/views/devise/registrations/new.html.erb +1 -1
- data/app/views/devise/sessions/new.html.erb +1 -1
- data/app/views/devise/shared/_links.erb +6 -0
- data/app/views/devise/unlocks/new.html.erb +1 -1
- data/config/locales/en.yml +9 -2
- data/lib/devise.rb +116 -58
- data/lib/devise/controllers/helpers.rb +103 -107
- data/lib/devise/controllers/internal_helpers.rb +23 -7
- data/lib/devise/controllers/scoped_views.rb +4 -6
- data/lib/devise/controllers/url_helpers.rb +3 -5
- data/lib/devise/encryptors/base.rb +1 -1
- data/lib/devise/encryptors/restful_authentication_sha1.rb +4 -4
- data/lib/devise/failure_app.rb +29 -21
- data/lib/devise/hooks/forgetable.rb +2 -1
- data/lib/devise/hooks/rememberable.rb +11 -9
- data/lib/devise/mapping.rb +12 -5
- data/lib/devise/models.rb +0 -14
- data/lib/devise/models/authenticatable.rb +40 -30
- data/lib/devise/models/confirmable.rb +11 -15
- data/lib/devise/models/database_authenticatable.rb +23 -35
- data/lib/devise/models/encryptable.rb +65 -0
- data/lib/devise/models/lockable.rb +8 -7
- data/lib/devise/models/omniauthable.rb +23 -0
- data/lib/devise/models/recoverable.rb +5 -3
- data/lib/devise/models/registerable.rb +13 -0
- data/lib/devise/models/rememberable.rb +38 -30
- data/lib/devise/models/timeoutable.rb +20 -3
- data/lib/devise/models/token_authenticatable.rb +19 -7
- data/lib/devise/models/validatable.rb +16 -4
- data/lib/devise/modules.rb +15 -8
- data/lib/devise/omniauth.rb +47 -0
- data/lib/devise/omniauth/config.rb +30 -0
- data/lib/devise/omniauth/test_helpers.rb +57 -0
- data/lib/devise/omniauth/url_helpers.rb +29 -0
- data/lib/devise/orm/active_record.rb +2 -0
- data/lib/devise/orm/mongoid.rb +4 -2
- data/lib/devise/rails.rb +26 -46
- data/lib/devise/rails/routes.rb +64 -20
- data/lib/devise/rails/warden_compat.rb +18 -20
- data/lib/devise/schema.rb +13 -14
- data/lib/devise/strategies/authenticatable.rb +33 -7
- data/lib/devise/strategies/database_authenticatable.rb +1 -1
- data/lib/devise/strategies/rememberable.rb +1 -1
- data/lib/devise/strategies/token_authenticatable.rb +6 -2
- data/lib/devise/test_helpers.rb +11 -1
- data/lib/devise/version.rb +1 -1
- data/lib/generators/active_record/templates/migration.rb +1 -0
- data/lib/generators/devise/orm_helpers.rb +3 -2
- data/lib/generators/templates/devise.rb +70 -39
- data/test/controllers/helpers_test.rb +43 -67
- data/test/controllers/internal_helpers_test.rb +29 -8
- data/test/controllers/url_helpers_test.rb +2 -1
- data/test/failure_app_test.rb +56 -21
- data/test/generators/generators_test_helper.rb +4 -0
- data/test/generators/install_generator_test.rb +14 -0
- data/test/generators/views_generator_test.rb +37 -0
- data/test/integration/authenticatable_test.rb +147 -62
- data/test/integration/database_authenticatable_test.rb +22 -0
- data/test/integration/http_authenticatable_test.rb +12 -2
- data/test/integration/omniauthable_test.rb +107 -0
- data/test/integration/recoverable_test.rb +39 -20
- data/test/integration/registerable_test.rb +30 -4
- data/test/integration/rememberable_test.rb +57 -34
- data/test/integration/timeoutable_test.rb +10 -1
- data/test/integration/token_authenticatable_test.rb +12 -17
- data/test/mailers/confirmation_instructions_test.rb +4 -0
- data/test/mailers/reset_password_instructions_test.rb +4 -0
- data/test/mailers/unlock_instructions_test.rb +4 -0
- data/test/mapping_test.rb +37 -3
- data/test/models/confirmable_test.rb +3 -3
- data/test/models/database_authenticatable_test.rb +14 -71
- data/test/models/encryptable_test.rb +65 -0
- data/test/models/lockable_test.rb +17 -1
- data/test/models/recoverable_test.rb +17 -0
- data/test/models/rememberable_test.rb +186 -125
- data/test/models/token_authenticatable_test.rb +1 -13
- data/test/models_test.rb +5 -5
- data/test/omniauth/url_helpers_test.rb +47 -0
- data/test/rails_app/app/active_record/admin.rb +4 -1
- data/test/rails_app/app/active_record/user.rb +5 -4
- data/test/rails_app/app/controllers/{sessions_controller.rb → admins/sessions_controller.rb} +1 -1
- data/test/rails_app/app/controllers/home_controller.rb +9 -0
- data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +7 -0
- data/test/rails_app/app/mongoid/admin.rb +4 -1
- data/test/rails_app/app/mongoid/shim.rb +16 -3
- data/test/rails_app/app/mongoid/user.rb +5 -5
- data/test/rails_app/config/initializers/devise.rb +52 -28
- data/test/rails_app/config/routes.rb +14 -6
- data/test/rails_app/db/migrate/20100401102949_create_tables.rb +21 -17
- data/test/rails_app/db/schema.rb +17 -51
- data/test/rails_app/lib/shared_admin.rb +9 -0
- data/test/rails_app/lib/shared_user.rb +23 -0
- data/test/routes_test.rb +42 -9
- data/test/support/integration.rb +3 -3
- data/test/support/webrat/integrations/rails.rb +7 -0
- data/test/test_helper.rb +2 -0
- data/test/test_helpers_test.rb +29 -0
- metadata +60 -30
- data/Gemfile +0 -27
- data/Gemfile.lock +0 -115
- data/Rakefile +0 -55
- data/TODO +0 -3
- data/lib/devise/encryptors/bcrypt.rb +0 -19
- data/lib/generators/devise_install_generator.rb +0 -4
- data/lib/generators/devise_views_generator.rb +0 -4
- data/test/indifferent_hash.rb +0 -33
- data/test/support/test_silencer.rb +0 -5
data/Gemfile
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
source "http://rubygems.org"
|
2
|
-
|
3
|
-
gemspec
|
4
|
-
|
5
|
-
gem "rails", "~> 3.0.4"
|
6
|
-
|
7
|
-
group :test do
|
8
|
-
gem "webrat", "0.7.2", :require => false
|
9
|
-
gem "mocha", :require => false
|
10
|
-
end
|
11
|
-
|
12
|
-
platforms :jruby do
|
13
|
-
gem 'activerecord-jdbcsqlite3-adapter'
|
14
|
-
end
|
15
|
-
|
16
|
-
platforms :ruby do
|
17
|
-
group :test do
|
18
|
-
gem "sqlite3-ruby"
|
19
|
-
gem "ruby-debug", ">= 0.10.3" if RUBY_VERSION < '1.9'
|
20
|
-
end
|
21
|
-
|
22
|
-
group :mongoid do
|
23
|
-
gem "mongo", "1.1.2"
|
24
|
-
gem "mongoid", "2.0.0.beta.20"
|
25
|
-
gem "bson_ext", "1.1.2"
|
26
|
-
end
|
27
|
-
end
|
data/Gemfile.lock
DELETED
@@ -1,115 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
devise (1.1.8)
|
5
|
-
bcrypt-ruby (~> 2.1.2)
|
6
|
-
warden (~> 1.0.2)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: http://rubygems.org/
|
10
|
-
specs:
|
11
|
-
abstract (1.0.0)
|
12
|
-
actionmailer (3.0.4)
|
13
|
-
actionpack (= 3.0.4)
|
14
|
-
mail (~> 2.2.15)
|
15
|
-
actionpack (3.0.4)
|
16
|
-
activemodel (= 3.0.4)
|
17
|
-
activesupport (= 3.0.4)
|
18
|
-
builder (~> 2.1.2)
|
19
|
-
erubis (~> 2.6.6)
|
20
|
-
i18n (~> 0.4)
|
21
|
-
rack (~> 1.2.1)
|
22
|
-
rack-mount (~> 0.6.13)
|
23
|
-
rack-test (~> 0.5.7)
|
24
|
-
tzinfo (~> 0.3.23)
|
25
|
-
activemodel (3.0.4)
|
26
|
-
activesupport (= 3.0.4)
|
27
|
-
builder (~> 2.1.2)
|
28
|
-
i18n (~> 0.4)
|
29
|
-
activerecord (3.0.4)
|
30
|
-
activemodel (= 3.0.4)
|
31
|
-
activesupport (= 3.0.4)
|
32
|
-
arel (~> 2.0.2)
|
33
|
-
tzinfo (~> 0.3.23)
|
34
|
-
activeresource (3.0.4)
|
35
|
-
activemodel (= 3.0.4)
|
36
|
-
activesupport (= 3.0.4)
|
37
|
-
activesupport (3.0.4)
|
38
|
-
arel (2.0.8)
|
39
|
-
bcrypt-ruby (2.1.4)
|
40
|
-
bson (1.1.2)
|
41
|
-
bson_ext (1.1.2)
|
42
|
-
builder (2.1.2)
|
43
|
-
columnize (0.3.2)
|
44
|
-
erubis (2.6.6)
|
45
|
-
abstract (>= 1.0.0)
|
46
|
-
i18n (0.5.0)
|
47
|
-
linecache (0.43)
|
48
|
-
mail (2.2.15)
|
49
|
-
activesupport (>= 2.3.6)
|
50
|
-
i18n (>= 0.4.0)
|
51
|
-
mime-types (~> 1.16)
|
52
|
-
treetop (~> 1.4.8)
|
53
|
-
mime-types (1.16)
|
54
|
-
mocha (0.9.9)
|
55
|
-
rake
|
56
|
-
mongo (1.1.2)
|
57
|
-
bson (>= 1.1.1)
|
58
|
-
mongoid (2.0.0.beta.20)
|
59
|
-
activemodel (~> 3.0)
|
60
|
-
mongo (~> 1.1)
|
61
|
-
tzinfo (~> 0.3.22)
|
62
|
-
will_paginate (~> 3.0.pre)
|
63
|
-
nokogiri (1.4.4)
|
64
|
-
polyglot (0.3.1)
|
65
|
-
rack (1.2.1)
|
66
|
-
rack-mount (0.6.13)
|
67
|
-
rack (>= 1.0.0)
|
68
|
-
rack-test (0.5.7)
|
69
|
-
rack (>= 1.0)
|
70
|
-
rails (3.0.4)
|
71
|
-
actionmailer (= 3.0.4)
|
72
|
-
actionpack (= 3.0.4)
|
73
|
-
activerecord (= 3.0.4)
|
74
|
-
activeresource (= 3.0.4)
|
75
|
-
activesupport (= 3.0.4)
|
76
|
-
bundler (~> 1.0)
|
77
|
-
railties (= 3.0.4)
|
78
|
-
railties (3.0.4)
|
79
|
-
actionpack (= 3.0.4)
|
80
|
-
activesupport (= 3.0.4)
|
81
|
-
rake (>= 0.8.7)
|
82
|
-
thor (~> 0.14.4)
|
83
|
-
rake (0.8.7)
|
84
|
-
ruby-debug (0.10.4)
|
85
|
-
columnize (>= 0.1)
|
86
|
-
ruby-debug-base (~> 0.10.4.0)
|
87
|
-
ruby-debug-base (0.10.4)
|
88
|
-
linecache (>= 0.3)
|
89
|
-
sqlite3-ruby (1.3.2)
|
90
|
-
thor (0.14.6)
|
91
|
-
treetop (1.4.9)
|
92
|
-
polyglot (>= 0.3.1)
|
93
|
-
tzinfo (0.3.24)
|
94
|
-
warden (1.0.3)
|
95
|
-
rack (>= 1.0.0)
|
96
|
-
webrat (0.7.2)
|
97
|
-
nokogiri (>= 1.2.0)
|
98
|
-
rack (>= 1.0)
|
99
|
-
rack-test (>= 0.5.3)
|
100
|
-
will_paginate (3.0.pre2)
|
101
|
-
|
102
|
-
PLATFORMS
|
103
|
-
ruby
|
104
|
-
|
105
|
-
DEPENDENCIES
|
106
|
-
activerecord-jdbcsqlite3-adapter
|
107
|
-
bson_ext (= 1.1.2)
|
108
|
-
devise!
|
109
|
-
mocha
|
110
|
-
mongo (= 1.1.2)
|
111
|
-
mongoid (= 2.0.0.beta.20)
|
112
|
-
rails (~> 3.0.4)
|
113
|
-
ruby-debug (>= 0.10.3)
|
114
|
-
sqlite3-ruby
|
115
|
-
webrat (= 0.7.2)
|
data/Rakefile
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
require 'rake'
|
4
|
-
require 'rake/testtask'
|
5
|
-
require 'rake/rdoctask'
|
6
|
-
require File.join(File.dirname(__FILE__), 'lib', 'devise', 'version')
|
7
|
-
|
8
|
-
desc 'Default: run tests for all ORMs.'
|
9
|
-
task :default => :pre_commit
|
10
|
-
|
11
|
-
desc 'Run Devise tests for all ORMs.'
|
12
|
-
task :pre_commit do
|
13
|
-
Dir[File.join(File.dirname(__FILE__), 'test', 'orm', '*.rb')].each do |file|
|
14
|
-
orm = File.basename(file).split(".").first
|
15
|
-
system "rake test DEVISE_ORM=#{orm}"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
desc 'Run Devise unit tests.'
|
20
|
-
Rake::TestTask.new(:test) do |t|
|
21
|
-
t.libs << 'lib'
|
22
|
-
t.libs << 'test'
|
23
|
-
t.pattern = 'test/**/*_test.rb'
|
24
|
-
t.verbose = true
|
25
|
-
end
|
26
|
-
|
27
|
-
desc 'Generate documentation for Devise.'
|
28
|
-
Rake::RDocTask.new(:rdoc) do |rdoc|
|
29
|
-
rdoc.rdoc_dir = 'rdoc'
|
30
|
-
rdoc.title = 'Devise'
|
31
|
-
rdoc.options << '--line-numbers' << '--inline-source'
|
32
|
-
rdoc.rdoc_files.include('README.rdoc')
|
33
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
34
|
-
end
|
35
|
-
|
36
|
-
begin
|
37
|
-
require 'jeweler'
|
38
|
-
Jeweler::Tasks.new do |s|
|
39
|
-
s.name = "devise"
|
40
|
-
s.version = Devise::VERSION.dup
|
41
|
-
s.summary = "Flexible authentication solution for Rails with Warden"
|
42
|
-
s.email = "contact@plataformatec.com.br"
|
43
|
-
s.homepage = "http://github.com/plataformatec/devise"
|
44
|
-
s.description = "Flexible authentication solution for Rails with Warden"
|
45
|
-
s.authors = ['José Valim', 'Carlos Antônio']
|
46
|
-
s.files = FileList["[A-Z]*", "{app,config,lib}/**/*"]
|
47
|
-
s.extra_rdoc_files = FileList["[A-Z]*"] - %w(Gemfile Rakefile)
|
48
|
-
s.add_dependency("warden", "~> 1.0.2")
|
49
|
-
s.add_dependency("bcrypt-ruby", "~> 2.1.2")
|
50
|
-
end
|
51
|
-
|
52
|
-
Jeweler::GemcutterTasks.new
|
53
|
-
rescue LoadError
|
54
|
-
puts "Jeweler, or one of its dependencies, is not available. Install it with: gem install jeweler"
|
55
|
-
end
|
data/TODO
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
require "bcrypt"
|
2
|
-
|
3
|
-
module Devise
|
4
|
-
module Encryptors
|
5
|
-
# = BCrypt
|
6
|
-
# Uses the BCrypt hash algorithm to encrypt passwords.
|
7
|
-
class Bcrypt < Base
|
8
|
-
# Gererates a default password digest based on stretches, salt, pepper and the
|
9
|
-
# incoming password. We don't strech it ourselves since BCrypt does so internally.
|
10
|
-
def self.digest(password, stretches, salt, pepper)
|
11
|
-
::BCrypt::Engine.hash_secret([password, pepper].join, salt, stretches)
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.salt(stretches)
|
15
|
-
::BCrypt::Engine.generate_salt(stretches)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
data/test/indifferent_hash.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class IndifferentHashTest < ActiveSupport::TestCase
|
4
|
-
setup do
|
5
|
-
@hash = Devise::IndifferentHash.new
|
6
|
-
end
|
7
|
-
|
8
|
-
test "it overwrites getter and setter" do
|
9
|
-
@hash[:foo] = "bar"
|
10
|
-
assert_equal "bar", @hash["foo"]
|
11
|
-
assert_equal "bar", @hash[:foo]
|
12
|
-
|
13
|
-
@hash["foo"] = "baz"
|
14
|
-
assert_equal "baz", @hash["foo"]
|
15
|
-
assert_equal "baz", @hash[:foo]
|
16
|
-
end
|
17
|
-
|
18
|
-
test "it overwrites update" do
|
19
|
-
@hash.update :foo => "bar"
|
20
|
-
assert_equal "bar", @hash["foo"]
|
21
|
-
assert_equal "bar", @hash[:foo]
|
22
|
-
|
23
|
-
@hash.update "foo" => "baz"
|
24
|
-
assert_equal "baz", @hash["foo"]
|
25
|
-
assert_equal "baz", @hash[:foo]
|
26
|
-
end
|
27
|
-
|
28
|
-
test "it returns a Hash on to_hash" do
|
29
|
-
@hash[:foo] = "bar"
|
30
|
-
assert_equal Hash["foo", "bar"], @hash.to_hash
|
31
|
-
assert_kind_of Hash, @hash.to_hash
|
32
|
-
end
|
33
|
-
end if defined?(Devise::IndifferentHash)
|