loyal_devise 2.1.2 → 2.1.3
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.
- data/.gitignore +2 -0
- data/.travis.yml +14 -9
- data/.yardopts +9 -0
- data/CHANGELOG.rdoc +60 -5
- data/CONTRIBUTING.md +4 -2
- data/Gemfile +7 -7
- data/Gemfile.lock +107 -101
- data/MIT-LICENSE +1 -1
- data/README.md +110 -48
- data/Rakefile +1 -0
- data/app/controllers/devise/confirmations_controller.rb +2 -4
- data/app/controllers/devise/omniauth_callbacks_controller.rb +0 -1
- data/app/controllers/devise/passwords_controller.rb +16 -5
- data/app/controllers/devise/registrations_controller.rb +13 -7
- data/app/controllers/devise/sessions_controller.rb +6 -6
- data/app/controllers/devise/unlocks_controller.rb +3 -4
- data/app/controllers/devise_controller.rb +12 -33
- data/app/helpers/devise_helper.rb +0 -1
- data/app/mailers/devise/mailer.rb +7 -8
- data/app/views/devise/mailer/confirmation_instructions.html.erb +1 -1
- data/app/views/devise/mailer/reset_password_instructions.html.erb +1 -1
- data/app/views/devise/registrations/edit.html.erb +5 -1
- data/config/locales/en.yml +48 -48
- data/devise.gemspec +6 -6
- data/devise.png +0 -0
- data/gemfiles/{Gemfile.rails-3.1.x → Gemfile.rails-3.2.x} +8 -12
- data/gemfiles/Gemfile.rails-3.2.x.lock +156 -0
- data/lib/devise.rb +34 -11
- data/lib/devise/controllers/helpers.rb +33 -7
- data/lib/devise/controllers/rememberable.rb +6 -3
- data/lib/devise/controllers/scoped_views.rb +1 -2
- data/lib/devise/controllers/url_helpers.rb +0 -1
- data/lib/devise/delegator.rb +0 -1
- data/lib/devise/failure_app.rb +8 -2
- data/lib/devise/hooks/activatable.rb +1 -2
- data/lib/devise/hooks/forgetable.rb +0 -1
- data/lib/devise/hooks/lockable.rb +1 -2
- data/lib/devise/hooks/rememberable.rb +1 -2
- data/lib/devise/hooks/timeoutable.rb +0 -1
- data/lib/devise/hooks/trackable.rb +0 -1
- data/lib/devise/mailers/helpers.rb +18 -14
- data/lib/devise/mapping.rb +6 -7
- data/lib/devise/models.rb +0 -1
- data/lib/devise/models/authenticatable.rb +50 -27
- data/lib/devise/models/confirmable.rb +37 -16
- data/lib/devise/models/database_authenticatable.rb +17 -3
- data/lib/devise/models/lockable.rb +1 -2
- data/lib/devise/models/omniauthable.rb +1 -2
- data/lib/devise/models/recoverable.rb +10 -6
- data/lib/devise/models/registerable.rb +0 -1
- data/lib/devise/models/rememberable.rb +1 -2
- data/lib/devise/models/timeoutable.rb +1 -2
- data/lib/devise/models/token_authenticatable.rb +0 -1
- data/lib/devise/models/trackable.rb +0 -1
- data/lib/devise/models/validatable.rb +0 -1
- data/lib/devise/modules.rb +1 -2
- data/lib/devise/omniauth.rb +0 -1
- data/lib/devise/omniauth/config.rb +0 -1
- data/lib/devise/omniauth/url_helpers.rb +0 -1
- data/lib/devise/orm/active_record.rb +1 -2
- data/lib/devise/orm/mongoid.rb +1 -2
- data/lib/devise/{param_filter.rb → parameter_filter.rb} +10 -12
- data/lib/devise/parameter_sanitizer.rb +59 -0
- data/lib/devise/rails.rb +0 -1
- data/lib/devise/rails/routes.rb +22 -18
- data/lib/devise/rails/warden_compat.rb +0 -30
- data/lib/devise/strategies/authenticatable.rb +8 -6
- data/lib/devise/strategies/base.rb +1 -2
- data/lib/devise/strategies/database_authenticatable.rb +1 -2
- data/lib/devise/strategies/rememberable.rb +1 -2
- data/lib/devise/strategies/token_authenticatable.rb +38 -4
- data/lib/devise/test_helpers.rb +0 -1
- data/lib/devise/time_inflector.rb +1 -2
- data/lib/devise/version.rb +1 -2
- data/lib/generators/active_record/devise_generator.rb +1 -5
- data/lib/generators/active_record/templates/migration.rb +0 -1
- data/lib/generators/active_record/templates/migration_existing.rb +0 -1
- data/lib/generators/devise/devise_generator.rb +0 -1
- data/lib/generators/devise/install_generator.rb +0 -1
- data/lib/generators/devise/orm_helpers.rb +1 -2
- data/lib/generators/devise/views_generator.rb +8 -3
- data/lib/generators/mongoid/devise_generator.rb +1 -2
- data/lib/generators/templates/README +1 -1
- data/lib/generators/templates/devise.rb +10 -5
- data/lib/generators/templates/markerb/confirmation_instructions.markerb +1 -1
- data/lib/generators/templates/simple_form_for/confirmations/new.html.erb +1 -0
- data/lib/generators/templates/simple_form_for/registrations/edit.html.erb +6 -1
- data/lib/generators/templates/simple_form_for/unlocks/new.html.erb +1 -0
- data/loyal_devise.gemspec +27 -0
- data/test/controllers/custom_strategy_test.rb +0 -1
- data/test/controllers/helpers_test.rb +0 -1
- data/test/controllers/internal_helpers_test.rb +13 -4
- data/test/controllers/passwords_controller_test.rb +32 -0
- data/test/controllers/sessions_controller_test.rb +28 -1
- data/test/controllers/url_helpers_test.rb +0 -1
- data/test/delegator_test.rb +0 -1
- data/test/devise_test.rb +12 -2
- data/test/failure_app_test.rb +3 -4
- data/test/generators/active_record_generator_test.rb +1 -4
- data/test/generators/devise_generator_test.rb +0 -1
- data/test/generators/install_generator_test.rb +0 -1
- data/test/generators/mongoid_generator_test.rb +0 -1
- data/test/generators/views_generator_test.rb +16 -2
- data/test/helpers/devise_helper_test.rb +1 -2
- data/test/integration/authenticatable_test.rb +92 -27
- data/test/integration/confirmable_test.rb +7 -7
- data/test/integration/database_authenticatable_test.rb +8 -7
- data/test/integration/http_authenticatable_test.rb +19 -2
- data/test/integration/lockable_test.rb +1 -2
- data/test/integration/omniauthable_test.rb +2 -3
- data/test/integration/recoverable_test.rb +40 -12
- data/test/integration/registerable_test.rb +17 -14
- data/test/integration/rememberable_test.rb +16 -10
- data/test/integration/timeoutable_test.rb +11 -2
- data/test/integration/token_authenticatable_test.rb +45 -2
- data/test/integration/trackable_test.rb +1 -2
- data/test/mailers/confirmation_instructions_test.rb +11 -3
- data/test/mailers/reset_password_instructions_test.rb +11 -3
- data/test/mailers/unlock_instructions_test.rb +11 -2
- data/test/mapping_test.rb +0 -1
- data/test/models/authenticatable_test.rb +6 -1
- data/test/models/confirmable_test.rb +53 -2
- data/test/models/database_authenticatable_test.rb +57 -21
- data/test/models/lockable_test.rb +1 -2
- data/test/models/omniauthable_test.rb +0 -1
- data/test/models/recoverable_test.rb +21 -5
- data/test/models/registerable_test.rb +0 -1
- data/test/models/rememberable_test.rb +4 -4
- data/test/models/serializable_test.rb +8 -8
- data/test/models/timeoutable_test.rb +0 -1
- data/test/models/token_authenticatable_test.rb +0 -1
- data/test/models/trackable_test.rb +0 -1
- data/test/models/validatable_test.rb +16 -6
- data/test/models_test.rb +7 -24
- data/test/omniauth/config_test.rb +1 -2
- data/test/omniauth/url_helpers_test.rb +4 -2
- data/test/orm/active_record.rb +1 -1
- data/test/orm/mongoid.rb +2 -4
- data/test/parameter_sanitizer_test.rb +51 -0
- data/test/rails_app/Rakefile +0 -4
- data/test/rails_app/app/active_record/admin.rb +0 -1
- data/test/rails_app/app/active_record/shim.rb +1 -2
- data/test/rails_app/app/active_record/user.rb +0 -1
- data/test/rails_app/app/controllers/admins/sessions_controller.rb +1 -2
- data/test/rails_app/app/controllers/admins_controller.rb +0 -1
- data/test/rails_app/app/controllers/application_controller.rb +1 -1
- data/test/rails_app/app/controllers/home_controller.rb +0 -1
- data/test/rails_app/app/controllers/publisher/registrations_controller.rb +1 -2
- data/test/rails_app/app/controllers/publisher/sessions_controller.rb +1 -2
- data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +1 -2
- data/test/rails_app/app/controllers/users_controller.rb +8 -1
- data/test/rails_app/app/helpers/application_helper.rb +0 -1
- data/test/rails_app/app/mailers/users/mailer.rb +4 -1
- data/test/rails_app/app/mongoid/admin.rb +4 -3
- data/test/rails_app/app/mongoid/shim.rb +3 -5
- data/test/rails_app/app/mongoid/user.rb +2 -3
- data/test/rails_app/app/views/users/edit_form.html.erb +1 -0
- data/test/rails_app/bin/bundle +3 -0
- data/test/rails_app/bin/rails +4 -0
- data/test/rails_app/bin/rake +4 -0
- data/test/rails_app/config/application.rb +1 -3
- data/test/rails_app/config/boot.rb +3 -4
- data/test/rails_app/config/environment.rb +2 -3
- data/test/rails_app/config/environments/development.rb +23 -8
- data/test/rails_app/config/environments/production.rb +68 -18
- data/test/rails_app/config/environments/test.rb +18 -16
- data/test/rails_app/config/initializers/backtrace_silencers.rb +0 -1
- data/test/rails_app/config/initializers/devise.rb +0 -1
- data/test/rails_app/config/initializers/inflections.rb +0 -1
- data/test/rails_app/config/initializers/secret_token.rb +8 -3
- data/test/rails_app/config/initializers/session_store.rb +1 -0
- data/test/rails_app/config/routes.rb +20 -17
- data/test/rails_app/db/migrate/20100401102949_create_tables.rb +0 -1
- data/test/rails_app/db/schema.rb +0 -1
- data/test/rails_app/lib/shared_admin.rb +0 -1
- data/test/rails_app/lib/shared_user.rb +0 -2
- data/test/routes_test.rb +22 -21
- data/test/support/assertions.rb +0 -1
- data/test/support/helpers.rb +1 -2
- data/test/support/integration.rb +0 -1
- data/test/support/webrat/integrations/rails.rb +0 -1
- data/test/test_helper.rb +8 -2
- data/test/test_helpers_test.rb +0 -1
- data/test/test_models.rb +26 -0
- metadata +65 -27
- data/gemfiles/Gemfile.rails-3.1.x.lock +0 -167
- data/test/indifferent_hash.rb +0 -34
- data/test/rails_app/script/rails +0 -10
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
|
2
1
|
unless defined?(DEVISE_ORM)
|
|
3
2
|
DEVISE_ORM = (ENV["DEVISE_ORM"] || :active_record).to_sym
|
|
4
3
|
end
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
# Set up gems listed in the Gemfile.
|
|
6
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
|
|
@@ -1,19 +1,34 @@
|
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
|
2
1
|
RailsApp::Application.configure do
|
|
3
|
-
# Settings specified here will take precedence over those in config/
|
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
|
4
3
|
|
|
5
4
|
# In the development environment your application's code is reloaded on
|
|
6
|
-
# every request.
|
|
7
|
-
# since you don't have to restart the
|
|
5
|
+
# every request. This slows down response time but is perfect for development
|
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
|
8
7
|
config.cache_classes = false
|
|
9
8
|
|
|
10
|
-
#
|
|
11
|
-
config.
|
|
9
|
+
# Do not eager load code on boot.
|
|
10
|
+
config.eager_load = false
|
|
12
11
|
|
|
13
|
-
# Show full error reports and disable caching
|
|
12
|
+
# Show full error reports and disable caching.
|
|
14
13
|
config.consider_all_requests_local = true
|
|
15
14
|
config.action_controller.perform_caching = false
|
|
16
15
|
|
|
17
|
-
# Don't care if the mailer can't send
|
|
16
|
+
# Don't care if the mailer can't send.
|
|
18
17
|
config.action_mailer.raise_delivery_errors = false
|
|
18
|
+
|
|
19
|
+
# Print deprecation notices to the Rails logger.
|
|
20
|
+
config.active_support.deprecation = :log
|
|
21
|
+
|
|
22
|
+
# Only use best-standards-support built into browsers.
|
|
23
|
+
config.action_dispatch.best_standards_support = :builtin
|
|
24
|
+
|
|
25
|
+
# Log the query plan for queries taking more than this (works
|
|
26
|
+
# with SQLite, MySQL, and PostgreSQL).
|
|
27
|
+
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
|
28
|
+
|
|
29
|
+
# Raise an error on page load if there are pending migrations
|
|
30
|
+
config.active_record.migration_error = :page_load
|
|
31
|
+
|
|
32
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
|
33
|
+
config.assets.debug = true
|
|
19
34
|
end
|
|
@@ -1,34 +1,84 @@
|
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
|
2
1
|
RailsApp::Application.configure do
|
|
3
|
-
# Settings specified here will take precedence over those in config/
|
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
|
4
3
|
|
|
5
|
-
#
|
|
6
|
-
# Code is not reloaded between requests
|
|
4
|
+
# Code is not reloaded between requests.
|
|
7
5
|
config.cache_classes = true
|
|
8
6
|
|
|
9
|
-
#
|
|
7
|
+
# Eager load code on boot. This eager loads most of Rails and
|
|
8
|
+
# your application in memory, allowing both thread web servers
|
|
9
|
+
# and those relying on copy on write to perform better.
|
|
10
|
+
# Rake tasks automatically ignore this option for performance.
|
|
11
|
+
config.eager_load = true
|
|
12
|
+
|
|
13
|
+
# Full error reports are disabled and caching is turned on.
|
|
10
14
|
config.consider_all_requests_local = false
|
|
11
15
|
config.action_controller.perform_caching = true
|
|
12
16
|
|
|
13
|
-
#
|
|
14
|
-
#
|
|
17
|
+
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
|
18
|
+
# Add `rack-cache` to your Gemfile before enabling this.
|
|
19
|
+
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
|
|
20
|
+
# config.action_dispatch.rack_cache = true
|
|
15
21
|
|
|
16
|
-
#
|
|
17
|
-
|
|
22
|
+
# Disable Rails's static asset server (Apache or nginx will already do this).
|
|
23
|
+
config.serve_static_assets = false
|
|
18
24
|
|
|
19
|
-
#
|
|
20
|
-
|
|
25
|
+
# Compress JavaScripts and CSS.
|
|
26
|
+
config.assets.js_compressor = :uglifier
|
|
27
|
+
# config.assets.css_compressor = :sass
|
|
21
28
|
|
|
22
|
-
#
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
# Whether to fallback to assets pipeline if a precompiled asset is missed.
|
|
30
|
+
config.assets.compile = false
|
|
31
|
+
|
|
32
|
+
# Generate digests for assets URLs.
|
|
33
|
+
config.assets.digest = true
|
|
34
|
+
|
|
35
|
+
# Version of your assets, change this if you want to expire all your assets.
|
|
36
|
+
config.assets.version = '1.0'
|
|
37
|
+
|
|
38
|
+
# Specifies the header that your server uses for sending files.
|
|
39
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
|
40
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
|
41
|
+
|
|
42
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
|
43
|
+
# config.force_ssl = true
|
|
44
|
+
|
|
45
|
+
# Set to :debug to see everything in the log.
|
|
46
|
+
config.log_level = :info
|
|
25
47
|
|
|
26
|
-
#
|
|
48
|
+
# Prepend all log lines with the following tags.
|
|
49
|
+
# config.log_tags = [ :subdomain, :uuid ]
|
|
50
|
+
|
|
51
|
+
# Use a different logger for distributed setups.
|
|
52
|
+
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
|
53
|
+
|
|
54
|
+
# Use a different cache store in production.
|
|
55
|
+
# config.cache_store = :mem_cache_store
|
|
56
|
+
|
|
57
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
|
27
58
|
# config.action_controller.asset_host = "http://assets.example.com"
|
|
28
59
|
|
|
29
|
-
#
|
|
60
|
+
# Precompile additional assets.
|
|
61
|
+
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
|
62
|
+
# config.assets.precompile += %w( search.js )
|
|
63
|
+
|
|
64
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
|
65
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
|
30
66
|
# config.action_mailer.raise_delivery_errors = false
|
|
31
67
|
|
|
32
|
-
# Enable
|
|
33
|
-
#
|
|
68
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
|
69
|
+
# the I18n.default_locale when a translation can not be found).
|
|
70
|
+
config.i18n.fallbacks = true
|
|
71
|
+
|
|
72
|
+
# Send deprecation notices to registered listeners.
|
|
73
|
+
config.active_support.deprecation = :notify
|
|
74
|
+
|
|
75
|
+
# Log the query plan for queries taking more than this (works
|
|
76
|
+
# with SQLite, MySQL, and PostgreSQL).
|
|
77
|
+
# config.active_record.auto_explain_threshold_in_seconds = 0.5
|
|
78
|
+
|
|
79
|
+
# Disable automatic flushing of the log to improve performance.
|
|
80
|
+
# config.autoflush_log = false
|
|
81
|
+
|
|
82
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
|
83
|
+
config.log_formatter = ::Logger::Formatter.new
|
|
34
84
|
end
|
|
@@ -1,34 +1,36 @@
|
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
|
2
1
|
RailsApp::Application.configure do
|
|
3
|
-
# Settings specified here will take precedence over those in config/
|
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
|
4
3
|
|
|
5
4
|
# The test environment is used exclusively to run your application's
|
|
6
|
-
# test suite.
|
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
|
7
6
|
# your test database is "scratch space" for the test suite and is wiped
|
|
8
|
-
# and recreated between test runs.
|
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
|
9
8
|
config.cache_classes = true
|
|
10
9
|
|
|
11
|
-
#
|
|
12
|
-
|
|
10
|
+
# Do not eager load code on boot. This avoids loading your whole application
|
|
11
|
+
# just for the purpose of running a single test. If you are using a tool that
|
|
12
|
+
# preloads Rails for running tests, you may have to set it to true.
|
|
13
|
+
config.eager_load = false
|
|
13
14
|
|
|
14
|
-
#
|
|
15
|
+
# Configure static asset server for tests with Cache-Control for performance.
|
|
16
|
+
config.serve_static_assets = true
|
|
17
|
+
config.static_cache_control = "public, max-age=3600"
|
|
18
|
+
|
|
19
|
+
# Show full error reports and disable caching.
|
|
15
20
|
config.consider_all_requests_local = true
|
|
16
21
|
config.action_controller.perform_caching = false
|
|
17
22
|
|
|
18
|
-
#
|
|
19
|
-
config.
|
|
23
|
+
# Raise exceptions instead of rendering exception templates.
|
|
24
|
+
config.action_dispatch.show_exceptions = false
|
|
25
|
+
|
|
26
|
+
# Disable request forgery protection in test environment.
|
|
27
|
+
config.action_controller.allow_forgery_protection = false
|
|
20
28
|
|
|
21
29
|
# Tell Action Mailer not to deliver emails to the real world.
|
|
22
30
|
# The :test delivery method accumulates sent emails in the
|
|
23
31
|
# ActionMailer::Base.deliveries array.
|
|
24
32
|
config.action_mailer.delivery_method = :test
|
|
25
33
|
|
|
26
|
-
#
|
|
27
|
-
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
|
28
|
-
# like if you have constraints or database-specific column types
|
|
29
|
-
# config.active_record.schema_format = :sql
|
|
30
|
-
|
|
31
|
-
config.action_dispatch.show_exceptions = false
|
|
32
|
-
|
|
34
|
+
# Print deprecation notices to the stderr.
|
|
33
35
|
config.active_support.deprecation = :stderr
|
|
34
36
|
end
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
config = Rails.application.config
|
|
2
|
+
|
|
3
|
+
if Devise.rails4?
|
|
4
|
+
config.secret_key_base = 'd588e99efff13a86461fd6ab82327823ad2f8feb5dc217ce652cdd9f0dfc5eb4b5a62a92d24d2574d7d51dfb1ea8dd453ea54e00cf672159a13104a135422a10'
|
|
5
|
+
else
|
|
6
|
+
config.secret_token = 'ea942c41850d502f2c8283e26bdc57829f471bb18224ddff0a192c4f32cdf6cb5aa0d82b3a7a7adbeb640c4b06f3aa1cd5f098162d8240f669b39d6b49680571'
|
|
7
|
+
config.session_store :cookie_store, :key => "_my_app"
|
|
8
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
RailsApp::Application.config.session_store :cookie_store, key: '_rails_app_session'
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
|
2
1
|
Rails.application.routes.draw do
|
|
3
2
|
# Resources for testing
|
|
4
3
|
resources :users, :only => [:index] do
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
member do
|
|
5
|
+
get :expire
|
|
6
|
+
get :accept
|
|
7
|
+
get :edit_form
|
|
8
|
+
put :update_form
|
|
9
|
+
end
|
|
7
10
|
|
|
8
11
|
authenticate do
|
|
9
12
|
post :exhibit, :on => :member
|
|
@@ -18,39 +21,39 @@ Rails.application.routes.draw do
|
|
|
18
21
|
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
|
|
19
22
|
|
|
20
23
|
as :user do
|
|
21
|
-
|
|
24
|
+
get "/as/sign_in", :to => "devise/sessions#new"
|
|
22
25
|
end
|
|
23
26
|
|
|
24
|
-
|
|
27
|
+
get "/sign_in", :to => "devise/sessions#new"
|
|
25
28
|
|
|
26
29
|
# Admin scope
|
|
27
30
|
devise_for :admin, :path => "admin_area", :controllers => { :sessions => :"admins/sessions" }, :skip => :passwords
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
get "/admin_area/home", :to => "admins#index", :as => :admin_root
|
|
33
|
+
get "/anywhere", :to => "foo#bar", :as => :new_admin_password
|
|
31
34
|
|
|
32
35
|
authenticate(:admin) do
|
|
33
|
-
|
|
36
|
+
get "/private", :to => "home#private", :as => :private
|
|
34
37
|
end
|
|
35
38
|
|
|
36
39
|
authenticate(:admin, lambda { |admin| admin.active? }) do
|
|
37
|
-
|
|
40
|
+
get "/private/active", :to => "home#private", :as => :private_active
|
|
38
41
|
end
|
|
39
42
|
|
|
40
43
|
authenticated :admin do
|
|
41
|
-
|
|
44
|
+
get "/dashboard", :to => "home#admin_dashboard"
|
|
42
45
|
end
|
|
43
46
|
|
|
44
47
|
authenticated :admin, lambda { |admin| admin.active? } do
|
|
45
|
-
|
|
48
|
+
get "/dashboard/active", :to => "home#admin_dashboard"
|
|
46
49
|
end
|
|
47
50
|
|
|
48
51
|
authenticated do
|
|
49
|
-
|
|
52
|
+
get "/dashboard", :to => "home#user_dashboard"
|
|
50
53
|
end
|
|
51
54
|
|
|
52
55
|
unauthenticated do
|
|
53
|
-
|
|
56
|
+
get "/join", :to => "home#join"
|
|
54
57
|
end
|
|
55
58
|
|
|
56
59
|
# Routes for constraints testing
|
|
@@ -93,9 +96,9 @@ Rails.application.routes.draw do
|
|
|
93
96
|
devise_for :delete_or_posts, :sign_out_via => [:delete, :post], :class_name => "Admin"
|
|
94
97
|
end
|
|
95
98
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
+
get "/set", :to => "home#set"
|
|
100
|
+
get "/unauthenticated", :to => "home#unauthenticated"
|
|
101
|
+
get "/custom_strategy/new"
|
|
99
102
|
|
|
100
|
-
root :to => "home#index"
|
|
103
|
+
root :to => "home#index", :via => [:get, :post]
|
|
101
104
|
end
|
data/test/rails_app/db/schema.rb
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
|
2
1
|
module SharedUser
|
|
3
2
|
extend ActiveSupport::Concern
|
|
4
3
|
|
|
@@ -8,7 +7,6 @@ module SharedUser
|
|
|
8
7
|
:trackable, :validatable, :omniauthable
|
|
9
8
|
|
|
10
9
|
attr_accessor :other_key
|
|
11
|
-
attr_accessible :username, :email, :password, :password_confirmation, :remember_me, :confirmation_sent_at
|
|
12
10
|
|
|
13
11
|
# They need to be included after Devise is called.
|
|
14
12
|
extend ExtendMethods
|
data/test/routes_test.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
|
2
1
|
require 'test_helper'
|
|
3
2
|
|
|
3
|
+
ExpectedRoutingError = Devise.rails4? ? MiniTest::Assertion : ActionController::RoutingError
|
|
4
|
+
|
|
4
5
|
class DefaultRoutingTest < ActionController::TestCase
|
|
5
6
|
test 'map new user session' do
|
|
6
7
|
assert_recognizes({:controller => 'devise/sessions', :action => 'new'}, {:path => 'users/sign_in', :method => :get})
|
|
@@ -102,7 +103,7 @@ class DefaultRoutingTest < ActionController::TestCase
|
|
|
102
103
|
assert_recognizes({:controller => 'users/omniauth_callbacks', :action => 'google'}, {:path => 'users/auth/google/callback', :method => :post})
|
|
103
104
|
assert_named_route "/users/auth/google/callback", :user_omniauth_callback_path, :google
|
|
104
105
|
|
|
105
|
-
assert_raise
|
|
106
|
+
assert_raise ExpectedRoutingError do
|
|
106
107
|
assert_recognizes({:controller => 'ysers/omniauth_callbacks', :action => 'twitter'}, {:path => 'users/auth/twitter/callback', :method => :get})
|
|
107
108
|
end
|
|
108
109
|
end
|
|
@@ -124,7 +125,7 @@ class CustomizedRoutingTest < ActionController::TestCase
|
|
|
124
125
|
end
|
|
125
126
|
|
|
126
127
|
test 'does not map admin password' do
|
|
127
|
-
assert_raise
|
|
128
|
+
assert_raise ExpectedRoutingError do
|
|
128
129
|
assert_recognizes({:controller => 'devise/passwords', :action => 'new'}, 'admin_area/password/new')
|
|
129
130
|
end
|
|
130
131
|
end
|
|
@@ -134,7 +135,7 @@ class CustomizedRoutingTest < ActionController::TestCase
|
|
|
134
135
|
end
|
|
135
136
|
|
|
136
137
|
test 'does only map reader password' do
|
|
137
|
-
assert_raise
|
|
138
|
+
assert_raise ExpectedRoutingError do
|
|
138
139
|
assert_recognizes({:controller => 'devise/sessions', :action => 'new'}, 'reader/sessions/new')
|
|
139
140
|
end
|
|
140
141
|
assert_recognizes({:controller => 'devise/passwords', :action => 'new'}, 'reader/password/new')
|
|
@@ -162,14 +163,14 @@ class CustomizedRoutingTest < ActionController::TestCase
|
|
|
162
163
|
|
|
163
164
|
test 'map deletes with :sign_out_via option' do
|
|
164
165
|
assert_recognizes({:controller => 'devise/sessions', :action => 'destroy'}, {:path => '/sign_out_via/deletes/sign_out', :method => :delete})
|
|
165
|
-
assert_raise
|
|
166
|
+
assert_raise ExpectedRoutingError do
|
|
166
167
|
assert_recognizes({:controller => 'devise/sessions', :action => 'destroy'}, {:path => '/sign_out_via/deletes/sign_out', :method => :get})
|
|
167
168
|
end
|
|
168
169
|
end
|
|
169
170
|
|
|
170
171
|
test 'map posts with :sign_out_via option' do
|
|
171
172
|
assert_recognizes({:controller => 'devise/sessions', :action => 'destroy'}, {:path => '/sign_out_via/posts/sign_out', :method => :post})
|
|
172
|
-
assert_raise
|
|
173
|
+
assert_raise ExpectedRoutingError do
|
|
173
174
|
assert_recognizes({:controller => 'devise/sessions', :action => 'destroy'}, {:path => '/sign_out_via/posts/sign_out', :method => :get})
|
|
174
175
|
end
|
|
175
176
|
end
|
|
@@ -177,56 +178,56 @@ class CustomizedRoutingTest < ActionController::TestCase
|
|
|
177
178
|
test 'map delete_or_posts with :sign_out_via option' do
|
|
178
179
|
assert_recognizes({:controller => 'devise/sessions', :action => 'destroy'}, {:path => '/sign_out_via/delete_or_posts/sign_out', :method => :post})
|
|
179
180
|
assert_recognizes({:controller => 'devise/sessions', :action => 'destroy'}, {:path => '/sign_out_via/delete_or_posts/sign_out', :method => :delete})
|
|
180
|
-
assert_raise
|
|
181
|
+
assert_raise ExpectedRoutingError do
|
|
181
182
|
assert_recognizes({:controller => 'devise/sessions', :action => 'destroy'}, {:path => '/sign_out_via/delete_or_posts/sign_out', :method => :get})
|
|
182
183
|
end
|
|
183
184
|
end
|
|
184
|
-
|
|
185
|
+
|
|
185
186
|
test 'map with constraints defined in hash' do
|
|
186
187
|
assert_recognizes({:controller => 'devise/registrations', :action => 'new'}, {:path => 'http://192.168.1.100/headquarters/sign_up', :method => :get})
|
|
187
|
-
assert_raise
|
|
188
|
+
assert_raise ExpectedRoutingError do
|
|
188
189
|
assert_recognizes({:controller => 'devise/registrations', :action => 'new'}, {:path => 'http://10.0.0.100/headquarters/sign_up', :method => :get})
|
|
189
190
|
end
|
|
190
191
|
end
|
|
191
|
-
|
|
192
|
+
|
|
192
193
|
test 'map with constraints defined in block' do
|
|
193
194
|
assert_recognizes({:controller => 'devise/registrations', :action => 'new'}, {:path => 'http://192.168.1.100/homebase/sign_up', :method => :get})
|
|
194
|
-
assert_raise
|
|
195
|
+
assert_raise ExpectedRoutingError do
|
|
195
196
|
assert_recognizes({:controller => 'devise/registrations', :action => 'new'}, {:path => 'http://10.0.0.100//homebase/sign_up', :method => :get})
|
|
196
197
|
end
|
|
197
198
|
end
|
|
198
|
-
|
|
199
|
+
|
|
199
200
|
test 'map with format false for sessions' do
|
|
200
201
|
assert_recognizes({:controller => 'devise/sessions', :action => 'new'}, {:path => '/htmlonly_admin/sign_in', :method => :get})
|
|
201
|
-
assert_raise
|
|
202
|
+
assert_raise ExpectedRoutingError do
|
|
202
203
|
assert_recognizes({:controller => 'devise/sessions', :action => 'new'}, {:path => '/htmlonly_admin/sign_in.xml', :method => :get})
|
|
203
204
|
end
|
|
204
205
|
end
|
|
205
|
-
|
|
206
|
+
|
|
206
207
|
test 'map with format false for passwords' do
|
|
207
208
|
assert_recognizes({:controller => 'devise/passwords', :action => 'create'}, {:path => '/htmlonly_admin/password', :method => :post})
|
|
208
|
-
assert_raise
|
|
209
|
+
assert_raise ExpectedRoutingError do
|
|
209
210
|
assert_recognizes({:controller => 'devise/passwords', :action => 'create'}, {:path => '/htmlonly_admin/password.xml', :method => :post})
|
|
210
211
|
end
|
|
211
212
|
end
|
|
212
|
-
|
|
213
|
+
|
|
213
214
|
test 'map with format false for registrations' do
|
|
214
215
|
assert_recognizes({:controller => 'devise/registrations', :action => 'new'}, {:path => '/htmlonly_admin/sign_up', :method => :get})
|
|
215
|
-
assert_raise
|
|
216
|
+
assert_raise ExpectedRoutingError do
|
|
216
217
|
assert_recognizes({:controller => 'devise/registrations', :action => 'new'}, {:path => '/htmlonly_admin/sign_up.xml', :method => :get})
|
|
217
218
|
end
|
|
218
219
|
end
|
|
219
|
-
|
|
220
|
+
|
|
220
221
|
test 'map with format false for confirmations' do
|
|
221
222
|
assert_recognizes({:controller => 'devise/confirmations', :action => 'show'}, {:path => '/htmlonly_users/confirmation', :method => :get})
|
|
222
|
-
assert_raise
|
|
223
|
+
assert_raise ExpectedRoutingError do
|
|
223
224
|
assert_recognizes({:controller => 'devise/confirmations', :action => 'show'}, {:path => '/htmlonly_users/confirmation.xml', :method => :get})
|
|
224
225
|
end
|
|
225
226
|
end
|
|
226
|
-
|
|
227
|
+
|
|
227
228
|
test 'map with format false for unlocks' do
|
|
228
229
|
assert_recognizes({:controller => 'devise/unlocks', :action => 'show'}, {:path => '/htmlonly_users/unlock', :method => :get})
|
|
229
|
-
assert_raise
|
|
230
|
+
assert_raise ExpectedRoutingError do
|
|
230
231
|
assert_recognizes({:controller => 'devise/unlocks', :action => 'show'}, {:path => '/htmlonly_users/unlock.xml', :method => :get})
|
|
231
232
|
end
|
|
232
233
|
end
|