devise 4.1.1 → 4.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +224 -4
- data/MIT-LICENSE +2 -1
- data/README.md +275 -90
- data/app/controllers/devise/confirmations_controller.rb +2 -0
- data/app/controllers/devise/omniauth_callbacks_controller.rb +7 -5
- data/app/controllers/devise/passwords_controller.rb +3 -0
- data/app/controllers/devise/registrations_controller.rb +34 -13
- data/app/controllers/devise/sessions_controller.rb +3 -1
- data/app/controllers/devise/unlocks_controller.rb +2 -0
- data/app/controllers/devise_controller.rb +5 -3
- data/app/helpers/devise_helper.rb +23 -18
- data/app/mailers/devise/mailer.rb +10 -4
- data/app/views/devise/confirmations/new.html.erb +2 -2
- data/app/views/devise/mailer/email_changed.html.erb +7 -0
- data/app/views/devise/passwords/edit.html.erb +3 -3
- data/app/views/devise/passwords/new.html.erb +2 -2
- data/app/views/devise/registrations/edit.html.erb +9 -5
- data/app/views/devise/registrations/new.html.erb +4 -4
- data/app/views/devise/sessions/new.html.erb +4 -4
- data/app/views/devise/shared/_error_messages.html.erb +15 -0
- data/app/views/devise/shared/_links.html.erb +8 -8
- data/app/views/devise/unlocks/new.html.erb +2 -2
- data/config/locales/en.yml +5 -2
- data/lib/devise.rb +39 -17
- data/lib/devise/controllers/helpers.rb +22 -9
- data/lib/devise/controllers/rememberable.rb +3 -1
- data/lib/devise/controllers/scoped_views.rb +2 -0
- data/lib/devise/controllers/sign_in_out.rb +39 -14
- data/lib/devise/controllers/store_location.rb +25 -7
- data/lib/devise/controllers/url_helpers.rb +3 -1
- data/lib/devise/delegator.rb +2 -0
- data/lib/devise/encryptor.rb +2 -0
- data/lib/devise/failure_app.rb +63 -33
- data/lib/devise/hooks/activatable.rb +2 -0
- data/lib/devise/hooks/csrf_cleaner.rb +2 -0
- data/lib/devise/hooks/forgetable.rb +2 -0
- data/lib/devise/hooks/lockable.rb +4 -2
- data/lib/devise/hooks/proxy.rb +3 -1
- data/lib/devise/hooks/rememberable.rb +2 -0
- data/lib/devise/hooks/timeoutable.rb +4 -2
- data/lib/devise/hooks/trackable.rb +2 -0
- data/lib/devise/mailers/helpers.rb +6 -3
- data/lib/devise/mapping.rb +3 -1
- data/lib/devise/models.rb +3 -1
- data/lib/devise/models/authenticatable.rb +63 -37
- data/lib/devise/models/confirmable.rb +79 -22
- data/lib/devise/models/database_authenticatable.rb +86 -17
- data/lib/devise/models/lockable.rb +17 -3
- data/lib/devise/models/omniauthable.rb +2 -0
- data/lib/devise/models/recoverable.rb +32 -20
- data/lib/devise/models/registerable.rb +4 -0
- data/lib/devise/models/rememberable.rb +5 -3
- data/lib/devise/models/timeoutable.rb +2 -0
- data/lib/devise/models/trackable.rb +15 -1
- data/lib/devise/models/validatable.rb +10 -3
- data/lib/devise/modules.rb +2 -0
- data/lib/devise/omniauth.rb +4 -5
- data/lib/devise/omniauth/config.rb +2 -0
- data/lib/devise/omniauth/url_helpers.rb +2 -51
- data/lib/devise/orm/active_record.rb +5 -1
- data/lib/devise/orm/mongoid.rb +6 -2
- data/lib/devise/parameter_filter.rb +4 -0
- data/lib/devise/parameter_sanitizer.rb +15 -56
- data/lib/devise/rails.rb +6 -6
- data/lib/devise/rails/deprecated_constant_accessor.rb +39 -0
- data/lib/devise/rails/routes.rb +9 -7
- data/lib/devise/rails/warden_compat.rb +2 -0
- data/lib/devise/secret_key_finder.rb +27 -0
- data/lib/devise/strategies/authenticatable.rb +3 -1
- data/lib/devise/strategies/base.rb +2 -0
- data/lib/devise/strategies/database_authenticatable.rb +8 -1
- data/lib/devise/strategies/rememberable.rb +2 -0
- data/lib/devise/test/controller_helpers.rb +167 -0
- data/lib/devise/test/integration_helpers.rb +63 -0
- data/lib/devise/test_helpers.rb +7 -129
- data/lib/devise/time_inflector.rb +2 -0
- data/lib/devise/token_generator.rb +2 -0
- data/lib/devise/version.rb +3 -1
- data/lib/generators/active_record/devise_generator.rb +40 -12
- data/lib/generators/active_record/templates/migration.rb +3 -1
- data/lib/generators/active_record/templates/migration_existing.rb +2 -0
- data/lib/generators/devise/controllers_generator.rb +3 -1
- data/lib/generators/devise/devise_generator.rb +5 -3
- data/lib/generators/devise/install_generator.rb +3 -5
- data/lib/generators/devise/orm_helpers.rb +9 -3
- data/lib/generators/devise/views_generator.rb +8 -9
- data/lib/generators/mongoid/devise_generator.rb +7 -5
- data/lib/generators/templates/README +9 -8
- data/lib/generators/templates/controllers/confirmations_controller.rb +2 -0
- data/lib/generators/templates/controllers/omniauth_callbacks_controller.rb +3 -1
- data/lib/generators/templates/controllers/passwords_controller.rb +2 -0
- data/lib/generators/templates/controllers/registrations_controller.rb +4 -2
- data/lib/generators/templates/controllers/sessions_controller.rb +3 -1
- data/lib/generators/templates/controllers/unlocks_controller.rb +2 -0
- data/lib/generators/templates/devise.rb +49 -6
- data/lib/generators/templates/markerb/email_changed.markerb +7 -0
- data/lib/generators/templates/markerb/password_change.markerb +2 -2
- data/lib/generators/templates/simple_form_for/confirmations/new.html.erb +5 -1
- data/lib/generators/templates/simple_form_for/passwords/edit.html.erb +10 -2
- data/lib/generators/templates/simple_form_for/passwords/new.html.erb +4 -1
- data/lib/generators/templates/simple_form_for/registrations/edit.html.erb +11 -3
- data/lib/generators/templates/simple_form_for/registrations/new.html.erb +11 -3
- data/lib/generators/templates/simple_form_for/sessions/new.html.erb +7 -2
- data/lib/generators/templates/simple_form_for/unlocks/new.html.erb +4 -1
- metadata +16 -297
- data/.gitignore +0 -10
- data/.travis.yml +0 -44
- data/.yardopts +0 -9
- data/CODE_OF_CONDUCT.md +0 -22
- data/CONTRIBUTING.md +0 -16
- data/Gemfile +0 -30
- data/Gemfile.lock +0 -182
- data/Rakefile +0 -36
- data/bin/test +0 -13
- data/devise.gemspec +0 -26
- data/devise.png +0 -0
- data/gemfiles/Gemfile.rails-4.1-stable +0 -30
- data/gemfiles/Gemfile.rails-4.1-stable.lock +0 -170
- data/gemfiles/Gemfile.rails-4.2-stable +0 -30
- data/gemfiles/Gemfile.rails-4.2-stable.lock +0 -192
- data/gemfiles/Gemfile.rails-5.0-beta +0 -37
- data/gemfiles/Gemfile.rails-5.0-beta.lock +0 -199
- data/test/controllers/custom_registrations_controller_test.rb +0 -40
- data/test/controllers/custom_strategy_test.rb +0 -64
- data/test/controllers/helper_methods_test.rb +0 -22
- data/test/controllers/helpers_test.rb +0 -316
- data/test/controllers/inherited_controller_i18n_messages_test.rb +0 -51
- data/test/controllers/internal_helpers_test.rb +0 -127
- data/test/controllers/load_hooks_controller_test.rb +0 -19
- data/test/controllers/passwords_controller_test.rb +0 -32
- data/test/controllers/sessions_controller_test.rb +0 -106
- data/test/controllers/url_helpers_test.rb +0 -65
- data/test/delegator_test.rb +0 -19
- data/test/devise_test.rb +0 -107
- data/test/failure_app_test.rb +0 -320
- data/test/generators/active_record_generator_test.rb +0 -83
- data/test/generators/controllers_generator_test.rb +0 -48
- data/test/generators/devise_generator_test.rb +0 -39
- data/test/generators/install_generator_test.rb +0 -24
- data/test/generators/mongoid_generator_test.rb +0 -23
- data/test/generators/views_generator_test.rb +0 -103
- data/test/helpers/devise_helper_test.rb +0 -49
- data/test/integration/authenticatable_test.rb +0 -698
- data/test/integration/confirmable_test.rb +0 -324
- data/test/integration/database_authenticatable_test.rb +0 -95
- data/test/integration/http_authenticatable_test.rb +0 -106
- data/test/integration/lockable_test.rb +0 -240
- data/test/integration/omniauthable_test.rb +0 -135
- data/test/integration/recoverable_test.rb +0 -347
- data/test/integration/registerable_test.rb +0 -357
- data/test/integration/rememberable_test.rb +0 -211
- data/test/integration/timeoutable_test.rb +0 -184
- data/test/integration/trackable_test.rb +0 -92
- data/test/mailers/confirmation_instructions_test.rb +0 -115
- data/test/mailers/reset_password_instructions_test.rb +0 -96
- data/test/mailers/unlock_instructions_test.rb +0 -91
- data/test/mapping_test.rb +0 -134
- data/test/models/authenticatable_test.rb +0 -23
- data/test/models/confirmable_test.rb +0 -511
- data/test/models/database_authenticatable_test.rb +0 -269
- data/test/models/lockable_test.rb +0 -350
- data/test/models/omniauthable_test.rb +0 -7
- data/test/models/recoverable_test.rb +0 -251
- data/test/models/registerable_test.rb +0 -7
- data/test/models/rememberable_test.rb +0 -169
- data/test/models/serializable_test.rb +0 -49
- data/test/models/timeoutable_test.rb +0 -51
- data/test/models/trackable_test.rb +0 -41
- data/test/models/validatable_test.rb +0 -119
- data/test/models_test.rb +0 -153
- data/test/omniauth/config_test.rb +0 -57
- data/test/omniauth/url_helpers_test.rb +0 -51
- data/test/orm/active_record.rb +0 -17
- data/test/orm/mongoid.rb +0 -13
- data/test/parameter_sanitizer_test.rb +0 -131
- data/test/rails_app/Rakefile +0 -6
- data/test/rails_app/app/active_record/admin.rb +0 -6
- data/test/rails_app/app/active_record/shim.rb +0 -2
- data/test/rails_app/app/active_record/user.rb +0 -7
- data/test/rails_app/app/active_record/user_on_engine.rb +0 -7
- data/test/rails_app/app/active_record/user_on_main_app.rb +0 -7
- data/test/rails_app/app/active_record/user_without_email.rb +0 -8
- data/test/rails_app/app/controllers/admins/sessions_controller.rb +0 -6
- data/test/rails_app/app/controllers/admins_controller.rb +0 -6
- data/test/rails_app/app/controllers/application_controller.rb +0 -11
- data/test/rails_app/app/controllers/application_with_fake_engine.rb +0 -30
- data/test/rails_app/app/controllers/custom/registrations_controller.rb +0 -31
- data/test/rails_app/app/controllers/home_controller.rb +0 -29
- data/test/rails_app/app/controllers/publisher/registrations_controller.rb +0 -2
- data/test/rails_app/app/controllers/publisher/sessions_controller.rb +0 -2
- data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +0 -14
- data/test/rails_app/app/controllers/users_controller.rb +0 -31
- data/test/rails_app/app/helpers/application_helper.rb +0 -3
- data/test/rails_app/app/mailers/users/from_proc_mailer.rb +0 -3
- data/test/rails_app/app/mailers/users/mailer.rb +0 -3
- data/test/rails_app/app/mailers/users/reply_to_mailer.rb +0 -4
- data/test/rails_app/app/mongoid/admin.rb +0 -29
- data/test/rails_app/app/mongoid/shim.rb +0 -23
- data/test/rails_app/app/mongoid/user.rb +0 -39
- data/test/rails_app/app/mongoid/user_on_engine.rb +0 -39
- data/test/rails_app/app/mongoid/user_on_main_app.rb +0 -39
- data/test/rails_app/app/mongoid/user_without_email.rb +0 -33
- data/test/rails_app/app/views/admins/index.html.erb +0 -1
- data/test/rails_app/app/views/admins/sessions/new.html.erb +0 -2
- data/test/rails_app/app/views/home/admin_dashboard.html.erb +0 -1
- data/test/rails_app/app/views/home/index.html.erb +0 -1
- data/test/rails_app/app/views/home/join.html.erb +0 -1
- data/test/rails_app/app/views/home/private.html.erb +0 -1
- data/test/rails_app/app/views/home/user_dashboard.html.erb +0 -1
- data/test/rails_app/app/views/layouts/application.html.erb +0 -24
- data/test/rails_app/app/views/users/edit_form.html.erb +0 -1
- data/test/rails_app/app/views/users/index.html.erb +0 -1
- data/test/rails_app/app/views/users/mailer/confirmation_instructions.erb +0 -1
- data/test/rails_app/app/views/users/sessions/new.html.erb +0 -1
- data/test/rails_app/bin/bundle +0 -3
- data/test/rails_app/bin/rails +0 -4
- data/test/rails_app/bin/rake +0 -4
- data/test/rails_app/config.ru +0 -4
- data/test/rails_app/config/application.rb +0 -44
- data/test/rails_app/config/boot.rb +0 -14
- data/test/rails_app/config/database.yml +0 -18
- data/test/rails_app/config/environment.rb +0 -5
- data/test/rails_app/config/environments/development.rb +0 -30
- data/test/rails_app/config/environments/production.rb +0 -84
- data/test/rails_app/config/environments/test.rb +0 -46
- data/test/rails_app/config/initializers/backtrace_silencers.rb +0 -7
- data/test/rails_app/config/initializers/devise.rb +0 -180
- data/test/rails_app/config/initializers/inflections.rb +0 -2
- data/test/rails_app/config/initializers/secret_token.rb +0 -3
- data/test/rails_app/config/initializers/session_store.rb +0 -1
- data/test/rails_app/config/routes.rb +0 -126
- data/test/rails_app/db/migrate/20100401102949_create_tables.rb +0 -71
- data/test/rails_app/db/schema.rb +0 -55
- data/test/rails_app/lib/shared_admin.rb +0 -17
- data/test/rails_app/lib/shared_user.rb +0 -30
- data/test/rails_app/lib/shared_user_without_email.rb +0 -26
- data/test/rails_app/lib/shared_user_without_omniauth.rb +0 -13
- data/test/rails_app/public/404.html +0 -26
- data/test/rails_app/public/422.html +0 -26
- data/test/rails_app/public/500.html +0 -26
- data/test/rails_app/public/favicon.ico +0 -0
- data/test/rails_test.rb +0 -9
- data/test/routes_test.rb +0 -279
- data/test/support/action_controller/record_identifier.rb +0 -10
- data/test/support/assertions.rb +0 -39
- data/test/support/helpers.rb +0 -77
- data/test/support/http_method_compatibility.rb +0 -51
- data/test/support/integration.rb +0 -92
- data/test/support/locale/en.yml +0 -8
- data/test/support/mongoid.yml +0 -6
- data/test/support/webrat/integrations/rails.rb +0 -33
- data/test/test_helper.rb +0 -34
- data/test/test_helpers_test.rb +0 -178
- data/test/test_models.rb +0 -33
@@ -1,46 +0,0 @@
|
|
1
|
-
RailsApp::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
-
|
4
|
-
# The test environment is used exclusively to run your application's
|
5
|
-
# test suite. You never need to work with it otherwise. Remember that
|
6
|
-
# your test database is "scratch space" for the test suite and is wiped
|
7
|
-
# and recreated between test runs. Don't rely on the data there!
|
8
|
-
config.cache_classes = true
|
9
|
-
|
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
|
14
|
-
|
15
|
-
# Disable serving static files from the `/public` folder by default since
|
16
|
-
# Apache or NGINX already handles this.
|
17
|
-
if Rails.version >= "4.2.0"
|
18
|
-
config.serve_static_files = true
|
19
|
-
else
|
20
|
-
config.serve_static_assets = true
|
21
|
-
end
|
22
|
-
|
23
|
-
if Rails.version >= "5.0.0"
|
24
|
-
config.public_file_server.headers = {'Cache-Control' => 'public, max-age=3600'}
|
25
|
-
else
|
26
|
-
config.static_cache_control = "public, max-age=3600"
|
27
|
-
end
|
28
|
-
|
29
|
-
# Show full error reports and disable caching.
|
30
|
-
config.consider_all_requests_local = true
|
31
|
-
config.action_controller.perform_caching = false
|
32
|
-
|
33
|
-
# Raise exceptions instead of rendering exception templates.
|
34
|
-
config.action_dispatch.show_exceptions = false
|
35
|
-
|
36
|
-
# Disable request forgery protection in test environment.
|
37
|
-
config.action_controller.allow_forgery_protection = false
|
38
|
-
|
39
|
-
# Tell Action Mailer not to deliver emails to the real world.
|
40
|
-
# The :test delivery method accumulates sent emails in the
|
41
|
-
# ActionMailer::Base.deliveries array.
|
42
|
-
config.action_mailer.delivery_method = :test
|
43
|
-
|
44
|
-
# Print deprecation notices to the stderr.
|
45
|
-
config.active_support.deprecation = :stderr
|
46
|
-
end
|
@@ -1,7 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
-
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
-
|
6
|
-
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
-
Rails.backtrace_cleaner.remove_silencers!
|
@@ -1,180 +0,0 @@
|
|
1
|
-
require "omniauth-facebook"
|
2
|
-
require "omniauth-openid"
|
3
|
-
|
4
|
-
# Use this hook to configure devise mailer, warden hooks and so forth. The first
|
5
|
-
# four configuration values can also be set straight in your models.
|
6
|
-
Devise.setup do |config|
|
7
|
-
config.secret_key = "d9eb5171c59a4c817f68b0de27b8c1e340c2341b52cdbc60d3083d4e8958532" \
|
8
|
-
"18dcc5f589cafde048faec956b61f864b9b5513ff9ce29bf9e5d58b0f234f8e3b"
|
9
|
-
|
10
|
-
# ==> Mailer Configuration
|
11
|
-
# Configure the e-mail address which will be shown in Devise::Mailer,
|
12
|
-
# note that it will be overwritten if you use your own mailer class with default "from" parameter.
|
13
|
-
config.mailer_sender = "please-change-me@config-initializers-devise.com"
|
14
|
-
|
15
|
-
|
16
|
-
config.parent_controller = "ApplicationWithFakeEngine"
|
17
|
-
# Configure the class responsible to send e-mails.
|
18
|
-
# config.mailer = "Devise::Mailer"
|
19
|
-
|
20
|
-
# ==> ORM configuration
|
21
|
-
# Load and configure the ORM. Supports :active_record (default) and
|
22
|
-
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
23
|
-
# available as additional gems.
|
24
|
-
require "devise/orm/#{DEVISE_ORM}"
|
25
|
-
|
26
|
-
# ==> Configuration for any authentication mechanism
|
27
|
-
# Configure which keys are used when authenticating a user. By default is
|
28
|
-
# just :email. You can configure it to use [:username, :subdomain], so for
|
29
|
-
# authenticating a user, both parameters are required. Remember that those
|
30
|
-
# parameters are used only when authenticating and not when retrieving from
|
31
|
-
# session. If you need permissions, you should implement that in a before filter.
|
32
|
-
# You can also supply hash where the value is a boolean expliciting if authentication
|
33
|
-
# should be aborted or not if the value is not present. By default is empty.
|
34
|
-
# config.authentication_keys = [:email]
|
35
|
-
|
36
|
-
# Configure parameters from the request object used for authentication. Each entry
|
37
|
-
# given should be a request method and it will automatically be passed to
|
38
|
-
# find_for_authentication method and considered in your model lookup. For instance,
|
39
|
-
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
40
|
-
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
41
|
-
# config.request_keys = []
|
42
|
-
|
43
|
-
# Configure which authentication keys should be case-insensitive.
|
44
|
-
# These keys will be downcased upon creating or modifying a user and when used
|
45
|
-
# to authenticate or find a user. Default is :email.
|
46
|
-
config.case_insensitive_keys = [:email]
|
47
|
-
|
48
|
-
# Configure which authentication keys should have whitespace stripped.
|
49
|
-
# These keys will have whitespace before and after removed upon creating or
|
50
|
-
# modifying a user and when used to authenticate or find a user. Default is :email.
|
51
|
-
config.strip_whitespace_keys = [:email]
|
52
|
-
|
53
|
-
# Tell if authentication through request.params is enabled. True by default.
|
54
|
-
# config.params_authenticatable = true
|
55
|
-
|
56
|
-
# Tell if authentication through HTTP Basic Auth is enabled. False by default.
|
57
|
-
config.http_authenticatable = true
|
58
|
-
|
59
|
-
# If http headers should be returned for AJAX requests. True by default.
|
60
|
-
# config.http_authenticatable_on_xhr = true
|
61
|
-
|
62
|
-
# The realm used in Http Basic Authentication. "Application" by default.
|
63
|
-
# config.http_authentication_realm = "Application"
|
64
|
-
|
65
|
-
# ==> Configuration for :database_authenticatable
|
66
|
-
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
67
|
-
# using other encryptors, it sets how many times you want the password re-encrypted.
|
68
|
-
config.stretches = Rails.env.test? ? 1 : 10
|
69
|
-
|
70
|
-
# ==> Configuration for :confirmable
|
71
|
-
# The time you want to give your user to confirm their account. During this time
|
72
|
-
# they will be able to access your application without confirming. Default is nil.
|
73
|
-
# When allow_unconfirmed_access_for is zero, the user won't be able to sign in without confirming.
|
74
|
-
# You can use this to let your user access some features of your application
|
75
|
-
# without confirming the account, but blocking it after a certain period
|
76
|
-
# (ie 2 days).
|
77
|
-
# config.allow_unconfirmed_access_for = 2.days
|
78
|
-
|
79
|
-
# Defines which key will be used when confirming an account
|
80
|
-
# config.confirmation_keys = [:email]
|
81
|
-
|
82
|
-
# ==> Configuration for :rememberable
|
83
|
-
# The time the user will be remembered without asking for credentials again.
|
84
|
-
# config.remember_for = 2.weeks
|
85
|
-
|
86
|
-
# If true, extends the user's remember period when remembered via cookie.
|
87
|
-
# config.extend_remember_period = false
|
88
|
-
|
89
|
-
# ==> Configuration for :validatable
|
90
|
-
# Range for password length. Default is 8..72.
|
91
|
-
# config.password_length = 8..72
|
92
|
-
|
93
|
-
# Regex to use to validate the email address
|
94
|
-
# config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
|
95
|
-
|
96
|
-
# ==> Configuration for :timeoutable
|
97
|
-
# The time you want to timeout the user session without activity. After this
|
98
|
-
# time the user will be asked for credentials again. Default is 30 minutes.
|
99
|
-
# config.timeout_in = 30.minutes
|
100
|
-
|
101
|
-
# ==> Configuration for :lockable
|
102
|
-
# Defines which strategy will be used to lock an account.
|
103
|
-
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
104
|
-
# :none = No lock strategy. You should handle locking by yourself.
|
105
|
-
# config.lock_strategy = :failed_attempts
|
106
|
-
|
107
|
-
# Defines which key will be used when locking and unlocking an account
|
108
|
-
# config.unlock_keys = [:email]
|
109
|
-
|
110
|
-
# Defines which strategy will be used to unlock an account.
|
111
|
-
# :email = Sends an unlock link to the user email
|
112
|
-
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
113
|
-
# :both = Enables both strategies
|
114
|
-
# :none = No unlock strategy. You should handle unlocking by yourself.
|
115
|
-
# config.unlock_strategy = :both
|
116
|
-
|
117
|
-
# Number of authentication tries before locking an account if lock_strategy
|
118
|
-
# is failed attempts.
|
119
|
-
# config.maximum_attempts = 20
|
120
|
-
|
121
|
-
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
122
|
-
# config.unlock_in = 1.hour
|
123
|
-
|
124
|
-
# ==> Configuration for :recoverable
|
125
|
-
#
|
126
|
-
# Defines which key will be used when recovering the password for an account
|
127
|
-
# config.reset_password_keys = [:email]
|
128
|
-
|
129
|
-
# Time interval you can reset your password with a reset password key.
|
130
|
-
# Don't put a too small interval or your users won't have the time to
|
131
|
-
# change their passwords.
|
132
|
-
config.reset_password_within = 2.hours
|
133
|
-
|
134
|
-
# When set to false, does not sign a user in automatically after their password is
|
135
|
-
# reset. Defaults to true, so a user is signed in automatically after a reset.
|
136
|
-
# config.sign_in_after_reset_password = true
|
137
|
-
|
138
|
-
# Set up a pepper to generate the encrypted password.
|
139
|
-
config.pepper = "d142367154e5beacca404b1a6a4f8bc52c6fdcfa3ccc3cf8eb49f3458a688ee6ac3b9fae488432a3bfca863b8a90008368a9f3a3dfbe5a962e64b6ab8f3a3a1a"
|
140
|
-
|
141
|
-
# ==> Scopes configuration
|
142
|
-
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
143
|
-
# "users/sessions/new". It's turned off by default because it's slower if you
|
144
|
-
# are using only default views.
|
145
|
-
# config.scoped_views = false
|
146
|
-
|
147
|
-
# Configure the default scope given to Warden. By default it's the first
|
148
|
-
# devise role declared in your routes (usually :user).
|
149
|
-
# config.default_scope = :user
|
150
|
-
|
151
|
-
# Configure sign_out behavior.
|
152
|
-
# Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
|
153
|
-
# The default is true, which means any logout action will sign out all active scopes.
|
154
|
-
# config.sign_out_all_scopes = true
|
155
|
-
|
156
|
-
# ==> Navigation configuration
|
157
|
-
# Lists the formats that should be treated as navigational. Formats like
|
158
|
-
# :html, should redirect to the sign in page when the user does not have
|
159
|
-
# access, but formats like :xml or :json, should return 401.
|
160
|
-
# If you have any extra navigational formats, like :iphone or :mobile, you
|
161
|
-
# should add them to the navigational formats lists. Default is [:html]
|
162
|
-
# config.navigational_formats = [:html, :iphone]
|
163
|
-
|
164
|
-
# The default HTTP method used to sign out a resource. Default is :get.
|
165
|
-
# config.sign_out_via = :get
|
166
|
-
|
167
|
-
# ==> OmniAuth
|
168
|
-
config.omniauth :facebook, 'APP_ID', 'APP_SECRET', scope: 'email,offline_access'
|
169
|
-
config.omniauth :openid
|
170
|
-
config.omniauth :openid, name: 'google', identifier: 'https://www.google.com/accounts/o8/id'
|
171
|
-
|
172
|
-
# ==> Warden configuration
|
173
|
-
# If you want to use other strategies, that are not supported by Devise, or
|
174
|
-
# change the failure app, you can configure them inside the config.warden block.
|
175
|
-
#
|
176
|
-
# config.warden do |manager|
|
177
|
-
# manager.failure_app = AnotherApp
|
178
|
-
# manager.default_strategies(scope: :user).unshift :some_external_strategy
|
179
|
-
# end
|
180
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
RailsApp::Application.config.session_store :cookie_store, key: '_rails_app_session'
|
@@ -1,126 +0,0 @@
|
|
1
|
-
Rails.application.routes.draw do
|
2
|
-
# Resources for testing
|
3
|
-
resources :users, only: [:index] do
|
4
|
-
member do
|
5
|
-
get :expire
|
6
|
-
get :accept
|
7
|
-
get :edit_form
|
8
|
-
put :update_form
|
9
|
-
end
|
10
|
-
|
11
|
-
authenticate do
|
12
|
-
post :exhibit, on: :member
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
resources :admins, only: [:index]
|
17
|
-
|
18
|
-
# Users scope
|
19
|
-
devise_for :users, controllers: { omniauth_callbacks: "users/omniauth_callbacks" }
|
20
|
-
|
21
|
-
devise_for :user_on_main_apps,
|
22
|
-
class_name: 'UserOnMainApp',
|
23
|
-
router_name: :main_app,
|
24
|
-
module: :devise
|
25
|
-
|
26
|
-
devise_for :user_on_engines,
|
27
|
-
class_name: 'UserOnEngine',
|
28
|
-
router_name: :fake_engine,
|
29
|
-
module: :devise
|
30
|
-
|
31
|
-
devise_for :user_without_email,
|
32
|
-
class_name: 'UserWithoutEmail',
|
33
|
-
router_name: :main_app,
|
34
|
-
module: :devise
|
35
|
-
|
36
|
-
as :user do
|
37
|
-
get "/as/sign_in", to: "devise/sessions#new"
|
38
|
-
end
|
39
|
-
|
40
|
-
get "/sign_in", to: "devise/sessions#new"
|
41
|
-
|
42
|
-
# Routes for custom controller testing
|
43
|
-
devise_for :user, only: [:registrations], controllers: { registrations: "custom/registrations" }, as: :custom, path: :custom
|
44
|
-
|
45
|
-
# Admin scope
|
46
|
-
devise_for :admin, path: "admin_area", controllers: { sessions: :"admins/sessions" }, skip: :passwords
|
47
|
-
|
48
|
-
get "/admin_area/home", to: "admins#index", as: :admin_root
|
49
|
-
get "/anywhere", to: "foo#bar", as: :new_admin_password
|
50
|
-
|
51
|
-
authenticate(:admin) do
|
52
|
-
get "/private", to: "home#private", as: :private
|
53
|
-
end
|
54
|
-
|
55
|
-
authenticate(:admin, lambda { |admin| admin.active? }) do
|
56
|
-
get "/private/active", to: "home#private", as: :private_active
|
57
|
-
end
|
58
|
-
|
59
|
-
authenticated :admin do
|
60
|
-
get "/dashboard", to: "home#admin_dashboard"
|
61
|
-
end
|
62
|
-
|
63
|
-
authenticated :admin, lambda { |admin| admin.active? } do
|
64
|
-
get "/dashboard/active", to: "home#admin_dashboard"
|
65
|
-
end
|
66
|
-
|
67
|
-
authenticated do
|
68
|
-
get "/dashboard", to: "home#user_dashboard"
|
69
|
-
end
|
70
|
-
|
71
|
-
unauthenticated do
|
72
|
-
get "/join", to: "home#join"
|
73
|
-
end
|
74
|
-
|
75
|
-
# Routes for constraints testing
|
76
|
-
devise_for :headquarters_admin, class_name: "Admin", path: "headquarters", constraints: {host: /192\.168\.1\.\d\d\d/}
|
77
|
-
|
78
|
-
constraints(host: /192\.168\.1\.\d\d\d/) do
|
79
|
-
devise_for :homebase_admin, class_name: "Admin", path: "homebase"
|
80
|
-
end
|
81
|
-
|
82
|
-
scope(subdomain: 'sub') do
|
83
|
-
devise_for :subdomain_users, class_name: "User", only: [:sessions]
|
84
|
-
end
|
85
|
-
|
86
|
-
devise_for :skip_admin, class_name: "Admin", skip: :all
|
87
|
-
|
88
|
-
# Routes for format=false testing
|
89
|
-
devise_for :htmlonly_admin, class_name: "Admin", skip: [:confirmations, :unlocks], path: "htmlonly_admin", format: false, skip_helpers: [:confirmations, :unlocks]
|
90
|
-
devise_for :htmlonly_users, class_name: "User", only: [:confirmations, :unlocks], path: "htmlonly_users", format: false, skip_helpers: true
|
91
|
-
|
92
|
-
# Other routes for routing_test.rb
|
93
|
-
devise_for :reader, class_name: "User", only: :passwords
|
94
|
-
|
95
|
-
scope host: "sub.example.com" do
|
96
|
-
devise_for :sub_admin, class_name: "Admin"
|
97
|
-
end
|
98
|
-
|
99
|
-
namespace :publisher, path_names: { sign_in: "i_dont_care", sign_out: "get_out" } do
|
100
|
-
devise_for :accounts, class_name: "Admin", path_names: { sign_in: "get_in" }
|
101
|
-
end
|
102
|
-
|
103
|
-
scope ":locale", module: :invalid do
|
104
|
-
devise_for :accounts, singular: "manager", class_name: "Admin",
|
105
|
-
path_names: {
|
106
|
-
sign_in: "login", sign_out: "logout",
|
107
|
-
password: "secret", confirmation: "verification",
|
108
|
-
unlock: "unblock", sign_up: "register",
|
109
|
-
registration: "management",
|
110
|
-
cancel: "giveup", edit: "edit/profile"
|
111
|
-
}, failure_app: lambda { |env| [404, {"Content-Type" => "text/plain"}, ["Oops, not found"]] }, module: :devise
|
112
|
-
end
|
113
|
-
|
114
|
-
namespace :sign_out_via, module: "devise" do
|
115
|
-
devise_for :deletes, sign_out_via: :delete, class_name: "Admin"
|
116
|
-
devise_for :posts, sign_out_via: :post, class_name: "Admin"
|
117
|
-
devise_for :gets, sign_out_via: :get, class_name: "Admin"
|
118
|
-
devise_for :delete_or_posts, sign_out_via: [:delete, :post], class_name: "Admin"
|
119
|
-
end
|
120
|
-
|
121
|
-
get "/set", to: "home#set"
|
122
|
-
get "/unauthenticated", to: "home#unauthenticated"
|
123
|
-
get "/custom_strategy/new"
|
124
|
-
|
125
|
-
root to: "home#index", via: [:get, :post]
|
126
|
-
end
|
@@ -1,71 +0,0 @@
|
|
1
|
-
class CreateTables < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table :users do |t|
|
4
|
-
t.string :username
|
5
|
-
t.string :facebook_token
|
6
|
-
|
7
|
-
## Database authenticatable
|
8
|
-
t.string :email, null: false, default: ""
|
9
|
-
t.string :encrypted_password, null: false, default: ""
|
10
|
-
|
11
|
-
## Recoverable
|
12
|
-
t.string :reset_password_token
|
13
|
-
t.datetime :reset_password_sent_at
|
14
|
-
|
15
|
-
## Rememberable
|
16
|
-
t.datetime :remember_created_at
|
17
|
-
|
18
|
-
## Trackable
|
19
|
-
t.integer :sign_in_count, default: 0
|
20
|
-
t.datetime :current_sign_in_at
|
21
|
-
t.datetime :last_sign_in_at
|
22
|
-
t.string :current_sign_in_ip
|
23
|
-
t.string :last_sign_in_ip
|
24
|
-
|
25
|
-
## Confirmable
|
26
|
-
t.string :confirmation_token
|
27
|
-
t.datetime :confirmed_at
|
28
|
-
t.datetime :confirmation_sent_at
|
29
|
-
# t.string :unconfirmed_email # Only if using reconfirmable
|
30
|
-
|
31
|
-
## Lockable
|
32
|
-
t.integer :failed_attempts, default: 0 # Only if lock strategy is :failed_attempts
|
33
|
-
t.string :unlock_token # Only if unlock strategy is :email or :both
|
34
|
-
t.datetime :locked_at
|
35
|
-
|
36
|
-
t.timestamps null: false
|
37
|
-
end
|
38
|
-
|
39
|
-
create_table :admins do |t|
|
40
|
-
## Database authenticatable
|
41
|
-
t.string :email, null: true
|
42
|
-
t.string :encrypted_password, null: true
|
43
|
-
|
44
|
-
## Recoverable
|
45
|
-
t.string :reset_password_token
|
46
|
-
t.datetime :reset_password_sent_at
|
47
|
-
|
48
|
-
## Rememberable
|
49
|
-
t.datetime :remember_created_at
|
50
|
-
|
51
|
-
## Confirmable
|
52
|
-
t.string :confirmation_token
|
53
|
-
t.datetime :confirmed_at
|
54
|
-
t.datetime :confirmation_sent_at
|
55
|
-
t.string :unconfirmed_email # Only if using reconfirmable
|
56
|
-
|
57
|
-
## Lockable
|
58
|
-
t.datetime :locked_at
|
59
|
-
|
60
|
-
## Attribute for testing route blocks
|
61
|
-
t.boolean :active, default: false
|
62
|
-
|
63
|
-
t.timestamps null: false
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
def self.down
|
68
|
-
drop_table :users
|
69
|
-
drop_table :admins
|
70
|
-
end
|
71
|
-
end
|