devise 3.2.4 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/.travis.yml +12 -5
- data/CHANGELOG.md +28 -1
- data/Gemfile +5 -5
- data/Gemfile.lock +98 -92
- data/README.md +22 -16
- data/app/controllers/devise/confirmations_controller.rb +1 -1
- data/app/controllers/devise/registrations_controller.rb +18 -5
- data/app/controllers/devise/sessions_controller.rb +32 -9
- data/app/controllers/devise_controller.rb +3 -3
- data/app/views/devise/registrations/new.html.erb +1 -1
- data/app/views/devise/sessions/new.html.erb +2 -2
- data/app/views/devise/shared/_links.erb +1 -1
- data/config/locales/en.yml +16 -15
- data/gemfiles/Gemfile.rails-3.2-stable +3 -3
- data/gemfiles/Gemfile.rails-3.2-stable.lock +166 -0
- data/gemfiles/Gemfile.rails-4.0-stable +4 -4
- data/gemfiles/Gemfile.rails-4.0-stable.lock +162 -0
- data/gemfiles/Gemfile.rails-head +7 -4
- data/gemfiles/Gemfile.rails-head.lock +190 -0
- data/lib/devise.rb +8 -4
- data/lib/devise/controllers/helpers.rb +77 -6
- data/lib/devise/controllers/sign_in_out.rb +0 -1
- data/lib/devise/controllers/store_location.rb +8 -2
- data/lib/devise/controllers/url_helpers.rb +3 -1
- data/lib/devise/failure_app.rb +6 -6
- data/lib/devise/hooks/activatable.rb +3 -4
- data/lib/devise/hooks/csrf_cleaner.rb +3 -1
- data/lib/devise/hooks/timeoutable.rb +8 -1
- data/lib/devise/mapping.rb +4 -1
- data/lib/devise/models/confirmable.rb +3 -3
- data/lib/devise/models/database_authenticatable.rb +7 -3
- data/lib/devise/models/lockable.rb +2 -2
- data/lib/devise/models/recoverable.rb +23 -7
- data/lib/devise/models/rememberable.rb +2 -2
- data/lib/devise/models/trackable.rb +4 -1
- data/lib/devise/rails/routes.rb +8 -6
- data/lib/devise/strategies/authenticatable.rb +7 -0
- data/lib/devise/version.rb +1 -1
- data/lib/generators/active_record/devise_generator.rb +19 -2
- data/lib/generators/templates/README +1 -1
- data/lib/generators/templates/devise.rb +3 -0
- data/script/cached-bundle +49 -0
- data/script/s3-put +71 -0
- data/test/controllers/custom_registrations_controller_test.rb +35 -0
- data/test/controllers/helpers_test.rb +35 -0
- data/test/controllers/internal_helpers_test.rb +1 -1
- data/test/controllers/passwords_controller_test.rb +1 -1
- data/test/devise_test.rb +18 -5
- data/test/failure_app_test.rb +40 -4
- data/test/generators/active_record_generator_test.rb +6 -0
- data/test/helpers/devise_helper_test.rb +3 -2
- data/test/integration/authenticatable_test.rb +19 -3
- data/test/integration/confirmable_test.rb +49 -9
- data/test/integration/http_authenticatable_test.rb +1 -1
- data/test/integration/lockable_test.rb +6 -6
- data/test/integration/recoverable_test.rb +5 -5
- data/test/integration/registerable_test.rb +32 -22
- data/test/integration/timeoutable_test.rb +8 -2
- data/test/integration/trackable_test.rb +2 -2
- data/test/mailers/confirmation_instructions_test.rb +3 -3
- data/test/mailers/reset_password_instructions_test.rb +3 -3
- data/test/mailers/unlock_instructions_test.rb +3 -3
- data/test/models/authenticatable_test.rb +1 -1
- data/test/models/lockable_test.rb +6 -0
- data/test/models/recoverable_test.rb +12 -0
- data/test/models/rememberable_test.rb +21 -6
- data/test/models/trackable_test.rb +28 -0
- data/test/models/validatable_test.rb +2 -2
- data/test/rails_app/app/active_record/user_on_engine.rb +7 -0
- data/test/rails_app/app/active_record/user_on_main_app.rb +7 -0
- data/test/rails_app/app/controllers/application_controller.rb +3 -0
- data/test/rails_app/app/controllers/application_with_fake_engine.rb +30 -0
- data/test/rails_app/app/controllers/custom/registrations_controller.rb +21 -0
- data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +1 -1
- data/test/rails_app/app/controllers/users_controller.rb +1 -1
- data/test/rails_app/app/mongoid/user_on_engine.rb +39 -0
- data/test/rails_app/app/mongoid/user_on_main_app.rb +39 -0
- data/test/rails_app/config/application.rb +1 -1
- data/test/rails_app/config/initializers/devise.rb +2 -0
- data/test/rails_app/config/routes.rb +17 -0
- data/test/rails_app/lib/shared_user.rb +1 -1
- data/test/rails_app/lib/shared_user_without_omniauth.rb +13 -0
- data/test/routes_test.rb +5 -3
- data/test/support/assertions.rb +2 -3
- data/test/support/integration.rb +2 -2
- data/test/test_helper.rb +2 -0
- data/test/test_helpers_test.rb +22 -32
- metadata +23 -2
|
@@ -10,4 +10,32 @@ class TrackableTest < ActiveSupport::TestCase
|
|
|
10
10
|
:sign_in_count
|
|
11
11
|
]
|
|
12
12
|
end
|
|
13
|
+
|
|
14
|
+
test 'update_tracked_fields should only set attributes but not save the record' do
|
|
15
|
+
user = create_user
|
|
16
|
+
request = mock
|
|
17
|
+
request.stubs(:remote_ip).returns("127.0.0.1")
|
|
18
|
+
|
|
19
|
+
assert_nil user.current_sign_in_ip
|
|
20
|
+
assert_nil user.last_sign_in_ip
|
|
21
|
+
assert_nil user.current_sign_in_at
|
|
22
|
+
assert_nil user.last_sign_in_at
|
|
23
|
+
assert_equal 0, user.sign_in_count
|
|
24
|
+
|
|
25
|
+
user.update_tracked_fields(request)
|
|
26
|
+
|
|
27
|
+
assert_equal "127.0.0.1", user.current_sign_in_ip
|
|
28
|
+
assert_equal "127.0.0.1", user.last_sign_in_ip
|
|
29
|
+
assert_not_nil user.current_sign_in_at
|
|
30
|
+
assert_not_nil user.last_sign_in_at
|
|
31
|
+
assert_equal 1, user.sign_in_count
|
|
32
|
+
|
|
33
|
+
user.reload
|
|
34
|
+
|
|
35
|
+
assert_nil user.current_sign_in_ip
|
|
36
|
+
assert_nil user.last_sign_in_ip
|
|
37
|
+
assert_nil user.current_sign_in_at
|
|
38
|
+
assert_nil user.last_sign_in_at
|
|
39
|
+
assert_equal 0, user.sign_in_count
|
|
40
|
+
end
|
|
13
41
|
end
|
|
@@ -86,10 +86,10 @@ class ValidatableTest < ActiveSupport::TestCase
|
|
|
86
86
|
end
|
|
87
87
|
end
|
|
88
88
|
|
|
89
|
-
test 'should require a password with minimum of
|
|
89
|
+
test 'should require a password with minimum of 7 characters' do
|
|
90
90
|
user = new_user(password: '12345', password_confirmation: '12345')
|
|
91
91
|
assert user.invalid?
|
|
92
|
-
assert_equal 'is too short (minimum is
|
|
92
|
+
assert_equal 'is too short (minimum is 7 characters)', user.errors[:password].join
|
|
93
93
|
end
|
|
94
94
|
|
|
95
95
|
test 'should require a password with maximum of 128 characters long' do
|
|
@@ -6,4 +6,7 @@ class ApplicationController < ActionController::Base
|
|
|
6
6
|
before_filter :current_user, unless: :devise_controller?
|
|
7
7
|
before_filter :authenticate_user!, if: :devise_controller?
|
|
8
8
|
respond_to *Mime::SET.map(&:to_sym)
|
|
9
|
+
|
|
10
|
+
devise_group :commenter, contains: [:user, :admin]
|
|
9
11
|
end
|
|
12
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
class ApplicationWithFakeEngine < ApplicationController
|
|
2
|
+
private
|
|
3
|
+
|
|
4
|
+
helper_method :fake_engine
|
|
5
|
+
def fake_engine
|
|
6
|
+
@fake_engine ||= FakeEngine.new
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
class FakeEngine
|
|
11
|
+
def user_on_engine_confirmation_path
|
|
12
|
+
'/user_on_engine/confirmation'
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def new_user_on_engine_session_path
|
|
16
|
+
'/user_on_engine/confirmation/new'
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def new_user_on_engine_registration_path
|
|
20
|
+
'/user_on_engine/registration/new'
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def new_user_on_engine_password_path
|
|
24
|
+
'/user_on_engine/password/new'
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def new_user_on_engine_unlock_path
|
|
28
|
+
'/user_on_engine/unlock/new'
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
class Custom::RegistrationsController < Devise::RegistrationsController
|
|
2
|
+
def create
|
|
3
|
+
super do |resource|
|
|
4
|
+
@create_block_called = true
|
|
5
|
+
end
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def update
|
|
9
|
+
super do |resource|
|
|
10
|
+
@update_block_called = true
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def create_block_called?
|
|
15
|
+
@create_block_called == true
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def update_block_called?
|
|
19
|
+
@update_block_called == true
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -6,7 +6,7 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
def sign_in_facebook
|
|
9
|
-
user = User.
|
|
9
|
+
user = User.to_adapter.find_first(email: 'user@test.com')
|
|
10
10
|
user.remember_me = true
|
|
11
11
|
sign_in user
|
|
12
12
|
render text: ""
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require 'shared_user_without_omniauth'
|
|
2
|
+
|
|
3
|
+
class UserOnEngine
|
|
4
|
+
include Mongoid::Document
|
|
5
|
+
include Shim
|
|
6
|
+
include SharedUserWithoutOmniauth
|
|
7
|
+
|
|
8
|
+
field :username, type: String
|
|
9
|
+
field :facebook_token, type: String
|
|
10
|
+
|
|
11
|
+
## Database authenticatable
|
|
12
|
+
field :email, type: String, default: ""
|
|
13
|
+
field :encrypted_password, type: String, default: ""
|
|
14
|
+
|
|
15
|
+
## Recoverable
|
|
16
|
+
field :reset_password_token, type: String
|
|
17
|
+
field :reset_password_sent_at, type: Time
|
|
18
|
+
|
|
19
|
+
## Rememberable
|
|
20
|
+
field :remember_created_at, type: Time
|
|
21
|
+
|
|
22
|
+
## Trackable
|
|
23
|
+
field :sign_in_count, type: Integer, default: 0
|
|
24
|
+
field :current_sign_in_at, type: Time
|
|
25
|
+
field :last_sign_in_at, type: Time
|
|
26
|
+
field :current_sign_in_ip, type: String
|
|
27
|
+
field :last_sign_in_ip, type: String
|
|
28
|
+
|
|
29
|
+
## Confirmable
|
|
30
|
+
field :confirmation_token, type: String
|
|
31
|
+
field :confirmed_at, type: Time
|
|
32
|
+
field :confirmation_sent_at, type: Time
|
|
33
|
+
# field :unconfirmed_email, type: String # Only if using reconfirmable
|
|
34
|
+
|
|
35
|
+
## Lockable
|
|
36
|
+
field :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts
|
|
37
|
+
field :unlock_token, type: String # Only if unlock strategy is :email or :both
|
|
38
|
+
field :locked_at, type: Time
|
|
39
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require 'shared_user_without_omniauth'
|
|
2
|
+
|
|
3
|
+
class UserOnMainApp
|
|
4
|
+
include Mongoid::Document
|
|
5
|
+
include Shim
|
|
6
|
+
include SharedUserWithoutOmniauth
|
|
7
|
+
|
|
8
|
+
field :username, type: String
|
|
9
|
+
field :facebook_token, type: String
|
|
10
|
+
|
|
11
|
+
## Database authenticatable
|
|
12
|
+
field :email, type: String, default: ""
|
|
13
|
+
field :encrypted_password, type: String, default: ""
|
|
14
|
+
|
|
15
|
+
## Recoverable
|
|
16
|
+
field :reset_password_token, type: String
|
|
17
|
+
field :reset_password_sent_at, type: Time
|
|
18
|
+
|
|
19
|
+
## Rememberable
|
|
20
|
+
field :remember_created_at, type: Time
|
|
21
|
+
|
|
22
|
+
## Trackable
|
|
23
|
+
field :sign_in_count, type: Integer, default: 0
|
|
24
|
+
field :current_sign_in_at, type: Time
|
|
25
|
+
field :last_sign_in_at, type: Time
|
|
26
|
+
field :current_sign_in_ip, type: String
|
|
27
|
+
field :last_sign_in_ip, type: String
|
|
28
|
+
|
|
29
|
+
## Confirmable
|
|
30
|
+
field :confirmation_token, type: String
|
|
31
|
+
field :confirmed_at, type: Time
|
|
32
|
+
field :confirmation_sent_at, type: Time
|
|
33
|
+
# field :unconfirmed_email, type: String # Only if using reconfirmable
|
|
34
|
+
|
|
35
|
+
## Lockable
|
|
36
|
+
field :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts
|
|
37
|
+
field :unlock_token, type: String # Only if unlock strategy is :email or :both
|
|
38
|
+
field :locked_at, type: Time
|
|
39
|
+
end
|
|
@@ -30,7 +30,7 @@ module RailsApp
|
|
|
30
30
|
config.filter_parameters << :password
|
|
31
31
|
config.assets.enabled = false
|
|
32
32
|
|
|
33
|
-
config.action_mailer.default_url_options = { host: "localhost:3000
|
|
33
|
+
config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
|
|
34
34
|
|
|
35
35
|
# This was used to break devise in some situations
|
|
36
36
|
config.to_prepare do
|
|
@@ -12,6 +12,8 @@ Devise.setup do |config|
|
|
|
12
12
|
# note that it will be overwritten if you use your own mailer class with default "from" parameter.
|
|
13
13
|
config.mailer_sender = "please-change-me@config-initializers-devise.com"
|
|
14
14
|
|
|
15
|
+
|
|
16
|
+
config.parent_controller = "ApplicationWithFakeEngine"
|
|
15
17
|
# Configure the class responsible to send e-mails.
|
|
16
18
|
# config.mailer = "Devise::Mailer"
|
|
17
19
|
|
|
@@ -20,12 +20,25 @@ Rails.application.routes.draw do
|
|
|
20
20
|
# Users scope
|
|
21
21
|
devise_for :users, controllers: { omniauth_callbacks: "users/omniauth_callbacks" }
|
|
22
22
|
|
|
23
|
+
devise_for :user_on_main_apps,
|
|
24
|
+
class_name: 'UserOnMainApp',
|
|
25
|
+
router_name: :main_app,
|
|
26
|
+
module: :devise
|
|
27
|
+
|
|
28
|
+
devise_for :user_on_engines,
|
|
29
|
+
class_name: 'UserOnEngine',
|
|
30
|
+
router_name: :fake_engine,
|
|
31
|
+
module: :devise
|
|
32
|
+
|
|
23
33
|
as :user do
|
|
24
34
|
get "/as/sign_in", to: "devise/sessions#new"
|
|
25
35
|
end
|
|
26
36
|
|
|
27
37
|
get "/sign_in", to: "devise/sessions#new"
|
|
28
38
|
|
|
39
|
+
# Routes for custom controller testing
|
|
40
|
+
devise_for :user, only: [:registrations], controllers: { registrations: "custom/registrations" }, as: :custom, path: :custom
|
|
41
|
+
|
|
29
42
|
# Admin scope
|
|
30
43
|
devise_for :admin, path: "admin_area", controllers: { sessions: :"admins/sessions" }, skip: :passwords
|
|
31
44
|
|
|
@@ -63,6 +76,10 @@ Rails.application.routes.draw do
|
|
|
63
76
|
devise_for :homebase_admin, class_name: "Admin", path: "homebase"
|
|
64
77
|
end
|
|
65
78
|
|
|
79
|
+
scope(subdomain: 'sub') do
|
|
80
|
+
devise_for :subdomain_users, class_name: "User", only: [:sessions]
|
|
81
|
+
end
|
|
82
|
+
|
|
66
83
|
devise_for :skip_admin, class_name: "Admin", skip: :all
|
|
67
84
|
|
|
68
85
|
# Routes for format=false testing
|
|
@@ -4,7 +4,7 @@ module SharedUser
|
|
|
4
4
|
included do
|
|
5
5
|
devise :database_authenticatable, :confirmable, :lockable, :recoverable,
|
|
6
6
|
:registerable, :rememberable, :timeoutable,
|
|
7
|
-
:trackable, :validatable, :omniauthable
|
|
7
|
+
:trackable, :validatable, :omniauthable, password_length: 7..128
|
|
8
8
|
|
|
9
9
|
attr_accessor :other_key
|
|
10
10
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module SharedUserWithoutOmniauth
|
|
2
|
+
extend ActiveSupport::Concern
|
|
3
|
+
|
|
4
|
+
included do
|
|
5
|
+
devise :database_authenticatable, :confirmable, :lockable, :recoverable,
|
|
6
|
+
:registerable, :rememberable, :timeoutable,
|
|
7
|
+
:trackable, :validatable
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def raw_confirmation_token
|
|
11
|
+
@raw_confirmation_token
|
|
12
|
+
end
|
|
13
|
+
end
|
data/test/routes_test.rb
CHANGED
|
@@ -241,11 +241,13 @@ class CustomizedRoutingTest < ActionController::TestCase
|
|
|
241
241
|
end
|
|
242
242
|
|
|
243
243
|
test 'checks if mapping has proper configuration for omniauth callback' do
|
|
244
|
-
assert_raise ArgumentError do
|
|
245
|
-
|
|
246
|
-
|
|
244
|
+
e = assert_raise ArgumentError do
|
|
245
|
+
routes = ActionDispatch::Routing::RouteSet.new
|
|
246
|
+
routes.draw do
|
|
247
|
+
devise_for :not_omniauthable, class_name: 'Admin', controllers: {omniauth_callbacks: "users/omniauth_callbacks"}
|
|
247
248
|
end
|
|
248
249
|
end
|
|
250
|
+
assert_match "Mapping omniauth_callbacks on a resource that is not omniauthable", e.message
|
|
249
251
|
end
|
|
250
252
|
end
|
|
251
253
|
|
data/test/support/assertions.rb
CHANGED
|
@@ -9,10 +9,9 @@ class ActiveSupport::TestCase
|
|
|
9
9
|
assert assertion.blank?
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
def
|
|
13
|
-
assert
|
|
12
|
+
def assert_present(assertion)
|
|
13
|
+
assert assertion.present?
|
|
14
14
|
end
|
|
15
|
-
alias :assert_present :assert_not_blank
|
|
16
15
|
|
|
17
16
|
def assert_email_sent(address = nil, &block)
|
|
18
17
|
assert_difference('ActionMailer::Base.deliveries.size', &block)
|
data/test/support/integration.rb
CHANGED
|
@@ -40,7 +40,7 @@ class ActionDispatch::IntegrationTest
|
|
|
40
40
|
fill_in 'password', with: options[:password] || '12345678'
|
|
41
41
|
check 'remember me' if options[:remember_me] == true
|
|
42
42
|
yield if block_given?
|
|
43
|
-
click_button '
|
|
43
|
+
click_button 'Log In'
|
|
44
44
|
user
|
|
45
45
|
end
|
|
46
46
|
|
|
@@ -50,7 +50,7 @@ class ActionDispatch::IntegrationTest
|
|
|
50
50
|
fill_in 'email', with: 'admin@test.com'
|
|
51
51
|
fill_in 'password', with: '123456'
|
|
52
52
|
yield if block_given?
|
|
53
|
-
click_button '
|
|
53
|
+
click_button 'Log In'
|
|
54
54
|
admin
|
|
55
55
|
end
|
|
56
56
|
|
data/test/test_helper.rb
CHANGED
|
@@ -17,6 +17,8 @@ Webrat.configure do |config|
|
|
|
17
17
|
config.open_error_files = false
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
+
OmniAuth.config.logger = Logger.new('/dev/null')
|
|
21
|
+
|
|
20
22
|
# Add support to load paths so we can overwrite broken webrat setup
|
|
21
23
|
$:.unshift File.expand_path('../support', __FILE__)
|
|
22
24
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
data/test/test_helpers_test.rb
CHANGED
|
@@ -4,12 +4,6 @@ class TestHelpersTest < ActionController::TestCase
|
|
|
4
4
|
tests UsersController
|
|
5
5
|
include Devise::TestHelpers
|
|
6
6
|
|
|
7
|
-
class CustomFailureApp < Devise::FailureApp
|
|
8
|
-
def redirect
|
|
9
|
-
self.status = 306
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
7
|
test "redirects if attempting to access a page unauthenticated" do
|
|
14
8
|
get :index
|
|
15
9
|
assert_redirected_to new_user_session_path
|
|
@@ -72,12 +66,30 @@ class TestHelpersTest < ActionController::TestCase
|
|
|
72
66
|
end
|
|
73
67
|
|
|
74
68
|
test "respects custom failure app" do
|
|
75
|
-
|
|
76
|
-
|
|
69
|
+
custom_failure_app = Class.new(Devise::FailureApp) do
|
|
70
|
+
def redirect
|
|
71
|
+
self.status = 306
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
swap Devise.warden_config, failure_app: custom_failure_app do
|
|
77
76
|
get :index
|
|
78
77
|
assert_response 306
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
test "passes given headers from the failure app to the response" do
|
|
82
|
+
custom_failure_app = Class.new(Devise::FailureApp) do
|
|
83
|
+
def respond
|
|
84
|
+
self.status = 401
|
|
85
|
+
self.response.headers["CUSTOMHEADER"] = 1
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
swap Devise.warden_config, failure_app: custom_failure_app do
|
|
90
|
+
sign_in create_user
|
|
91
|
+
get :index
|
|
92
|
+
assert_equal 1, @response.headers["CUSTOMHEADER"]
|
|
81
93
|
end
|
|
82
94
|
end
|
|
83
95
|
|
|
@@ -148,26 +160,4 @@ class TestHelpersTest < ActionController::TestCase
|
|
|
148
160
|
get :index
|
|
149
161
|
assert_match /User ##{second_user.id}/, @response.body
|
|
150
162
|
end
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
test "passes given headers from the failure app to the response" do
|
|
154
|
-
|
|
155
|
-
begin
|
|
156
|
-
old_failure_app = Devise.warden_config[:failure_app]
|
|
157
|
-
class CustomTestFailureApp < Devise::FailureApp
|
|
158
|
-
def respond
|
|
159
|
-
self.status = 401
|
|
160
|
-
self.response.headers["CUSTOMHEADER"] = 1
|
|
161
|
-
end
|
|
162
|
-
end
|
|
163
|
-
Devise.warden_config[:failure_app] = CustomTestFailureApp
|
|
164
|
-
user = create_user
|
|
165
|
-
sign_in user
|
|
166
|
-
get :index
|
|
167
|
-
assert_equal 1, @response.headers["CUSTOMHEADER"]
|
|
168
|
-
ensure
|
|
169
|
-
Devise.warden_config[:failure_app] = old_failure_app
|
|
170
|
-
end
|
|
171
|
-
end
|
|
172
|
-
|
|
173
163
|
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: 3.
|
|
4
|
+
version: 3.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- José Valim
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2014-
|
|
12
|
+
date: 2014-08-13 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: warden
|
|
@@ -127,8 +127,11 @@ files:
|
|
|
127
127
|
- devise.gemspec
|
|
128
128
|
- devise.png
|
|
129
129
|
- gemfiles/Gemfile.rails-3.2-stable
|
|
130
|
+
- gemfiles/Gemfile.rails-3.2-stable.lock
|
|
130
131
|
- gemfiles/Gemfile.rails-4.0-stable
|
|
132
|
+
- gemfiles/Gemfile.rails-4.0-stable.lock
|
|
131
133
|
- gemfiles/Gemfile.rails-head
|
|
134
|
+
- gemfiles/Gemfile.rails-head.lock
|
|
132
135
|
- lib/devise.rb
|
|
133
136
|
- lib/devise/controllers/helpers.rb
|
|
134
137
|
- lib/devise/controllers/rememberable.rb
|
|
@@ -199,6 +202,9 @@ files:
|
|
|
199
202
|
- lib/generators/templates/simple_form_for/registrations/new.html.erb
|
|
200
203
|
- lib/generators/templates/simple_form_for/sessions/new.html.erb
|
|
201
204
|
- lib/generators/templates/simple_form_for/unlocks/new.html.erb
|
|
205
|
+
- script/cached-bundle
|
|
206
|
+
- script/s3-put
|
|
207
|
+
- test/controllers/custom_registrations_controller_test.rb
|
|
202
208
|
- test/controllers/custom_strategy_test.rb
|
|
203
209
|
- test/controllers/helpers_test.rb
|
|
204
210
|
- test/controllers/internal_helpers_test.rb
|
|
@@ -251,9 +257,13 @@ files:
|
|
|
251
257
|
- test/rails_app/app/active_record/admin.rb
|
|
252
258
|
- test/rails_app/app/active_record/shim.rb
|
|
253
259
|
- test/rails_app/app/active_record/user.rb
|
|
260
|
+
- test/rails_app/app/active_record/user_on_engine.rb
|
|
261
|
+
- test/rails_app/app/active_record/user_on_main_app.rb
|
|
254
262
|
- test/rails_app/app/controllers/admins/sessions_controller.rb
|
|
255
263
|
- test/rails_app/app/controllers/admins_controller.rb
|
|
256
264
|
- test/rails_app/app/controllers/application_controller.rb
|
|
265
|
+
- test/rails_app/app/controllers/application_with_fake_engine.rb
|
|
266
|
+
- test/rails_app/app/controllers/custom/registrations_controller.rb
|
|
257
267
|
- test/rails_app/app/controllers/home_controller.rb
|
|
258
268
|
- test/rails_app/app/controllers/publisher/registrations_controller.rb
|
|
259
269
|
- test/rails_app/app/controllers/publisher/sessions_controller.rb
|
|
@@ -264,6 +274,8 @@ files:
|
|
|
264
274
|
- test/rails_app/app/mongoid/admin.rb
|
|
265
275
|
- test/rails_app/app/mongoid/shim.rb
|
|
266
276
|
- test/rails_app/app/mongoid/user.rb
|
|
277
|
+
- test/rails_app/app/mongoid/user_on_engine.rb
|
|
278
|
+
- test/rails_app/app/mongoid/user_on_main_app.rb
|
|
267
279
|
- test/rails_app/app/views/admins/index.html.erb
|
|
268
280
|
- test/rails_app/app/views/admins/sessions/new.html.erb
|
|
269
281
|
- test/rails_app/app/views/home/admin_dashboard.html.erb
|
|
@@ -297,6 +309,7 @@ files:
|
|
|
297
309
|
- test/rails_app/db/schema.rb
|
|
298
310
|
- test/rails_app/lib/shared_admin.rb
|
|
299
311
|
- test/rails_app/lib/shared_user.rb
|
|
312
|
+
- test/rails_app/lib/shared_user_without_omniauth.rb
|
|
300
313
|
- test/rails_app/public/404.html
|
|
301
314
|
- test/rails_app/public/422.html
|
|
302
315
|
- test/rails_app/public/500.html
|
|
@@ -337,6 +350,7 @@ signing_key:
|
|
|
337
350
|
specification_version: 4
|
|
338
351
|
summary: Flexible authentication solution for Rails with Warden
|
|
339
352
|
test_files:
|
|
353
|
+
- test/controllers/custom_registrations_controller_test.rb
|
|
340
354
|
- test/controllers/custom_strategy_test.rb
|
|
341
355
|
- test/controllers/helpers_test.rb
|
|
342
356
|
- test/controllers/internal_helpers_test.rb
|
|
@@ -389,9 +403,13 @@ test_files:
|
|
|
389
403
|
- test/rails_app/app/active_record/admin.rb
|
|
390
404
|
- test/rails_app/app/active_record/shim.rb
|
|
391
405
|
- test/rails_app/app/active_record/user.rb
|
|
406
|
+
- test/rails_app/app/active_record/user_on_engine.rb
|
|
407
|
+
- test/rails_app/app/active_record/user_on_main_app.rb
|
|
392
408
|
- test/rails_app/app/controllers/admins/sessions_controller.rb
|
|
393
409
|
- test/rails_app/app/controllers/admins_controller.rb
|
|
394
410
|
- test/rails_app/app/controllers/application_controller.rb
|
|
411
|
+
- test/rails_app/app/controllers/application_with_fake_engine.rb
|
|
412
|
+
- test/rails_app/app/controllers/custom/registrations_controller.rb
|
|
395
413
|
- test/rails_app/app/controllers/home_controller.rb
|
|
396
414
|
- test/rails_app/app/controllers/publisher/registrations_controller.rb
|
|
397
415
|
- test/rails_app/app/controllers/publisher/sessions_controller.rb
|
|
@@ -402,6 +420,8 @@ test_files:
|
|
|
402
420
|
- test/rails_app/app/mongoid/admin.rb
|
|
403
421
|
- test/rails_app/app/mongoid/shim.rb
|
|
404
422
|
- test/rails_app/app/mongoid/user.rb
|
|
423
|
+
- test/rails_app/app/mongoid/user_on_engine.rb
|
|
424
|
+
- test/rails_app/app/mongoid/user_on_main_app.rb
|
|
405
425
|
- test/rails_app/app/views/admins/index.html.erb
|
|
406
426
|
- test/rails_app/app/views/admins/sessions/new.html.erb
|
|
407
427
|
- test/rails_app/app/views/home/admin_dashboard.html.erb
|
|
@@ -435,6 +455,7 @@ test_files:
|
|
|
435
455
|
- test/rails_app/db/schema.rb
|
|
436
456
|
- test/rails_app/lib/shared_admin.rb
|
|
437
457
|
- test/rails_app/lib/shared_user.rb
|
|
458
|
+
- test/rails_app/lib/shared_user_without_omniauth.rb
|
|
438
459
|
- test/rails_app/public/404.html
|
|
439
460
|
- test/rails_app/public/422.html
|
|
440
461
|
- test/rails_app/public/500.html
|