devise 3.2.4 → 4.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (235) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +259 -994
  3. data/MIT-LICENSE +1 -1
  4. data/README.md +336 -99
  5. data/app/controllers/devise/confirmations_controller.rb +9 -3
  6. data/app/controllers/devise/omniauth_callbacks_controller.rb +12 -6
  7. data/app/controllers/devise/passwords_controller.rb +19 -6
  8. data/app/controllers/devise/registrations_controller.rb +55 -22
  9. data/app/controllers/devise/sessions_controller.rb +44 -14
  10. data/app/controllers/devise/unlocks_controller.rb +7 -2
  11. data/app/controllers/devise_controller.rb +65 -29
  12. data/app/helpers/devise_helper.rb +12 -19
  13. data/app/mailers/devise/mailer.rb +10 -0
  14. data/app/views/devise/confirmations/new.html.erb +8 -4
  15. data/app/views/devise/mailer/email_changed.html.erb +7 -0
  16. data/app/views/devise/mailer/password_change.html.erb +3 -0
  17. data/app/views/devise/passwords/edit.html.erb +15 -6
  18. data/app/views/devise/passwords/new.html.erb +8 -4
  19. data/app/views/devise/registrations/edit.html.erb +27 -13
  20. data/app/views/devise/registrations/new.html.erb +19 -8
  21. data/app/views/devise/sessions/new.html.erb +18 -9
  22. data/app/views/devise/shared/_error_messages.html.erb +15 -0
  23. data/app/views/devise/shared/{_links.erb → _links.html.erb} +9 -9
  24. data/app/views/devise/unlocks/new.html.erb +8 -4
  25. data/config/locales/en.yml +22 -16
  26. data/lib/devise/controllers/helpers.rb +109 -29
  27. data/lib/devise/controllers/rememberable.rb +12 -3
  28. data/lib/devise/controllers/scoped_views.rb +2 -0
  29. data/lib/devise/controllers/sign_in_out.rb +36 -20
  30. data/lib/devise/controllers/store_location.rb +31 -5
  31. data/lib/devise/controllers/url_helpers.rb +9 -7
  32. data/lib/devise/delegator.rb +2 -0
  33. data/lib/devise/encryptor.rb +24 -0
  34. data/lib/devise/failure_app.rb +116 -36
  35. data/lib/devise/hooks/activatable.rb +5 -4
  36. data/lib/devise/hooks/csrf_cleaner.rb +5 -1
  37. data/lib/devise/hooks/forgetable.rb +2 -0
  38. data/lib/devise/hooks/lockable.rb +6 -1
  39. data/lib/devise/hooks/proxy.rb +3 -1
  40. data/lib/devise/hooks/rememberable.rb +2 -0
  41. data/lib/devise/hooks/timeoutable.rb +15 -8
  42. data/lib/devise/hooks/trackable.rb +2 -0
  43. data/lib/devise/mailers/helpers.rb +7 -4
  44. data/lib/devise/mapping.rb +8 -2
  45. data/lib/devise/models/authenticatable.rb +76 -51
  46. data/lib/devise/models/confirmable.rb +129 -34
  47. data/lib/devise/models/database_authenticatable.rb +107 -30
  48. data/lib/devise/models/lockable.rb +19 -9
  49. data/lib/devise/models/omniauthable.rb +2 -0
  50. data/lib/devise/models/recoverable.rb +62 -26
  51. data/lib/devise/models/registerable.rb +4 -0
  52. data/lib/devise/models/rememberable.rb +58 -29
  53. data/lib/devise/models/timeoutable.rb +2 -6
  54. data/lib/devise/models/trackable.rb +20 -4
  55. data/lib/devise/models/validatable.rb +12 -5
  56. data/lib/devise/models.rb +3 -1
  57. data/lib/devise/modules.rb +2 -0
  58. data/lib/devise/omniauth/config.rb +2 -0
  59. data/lib/devise/omniauth/url_helpers.rb +14 -5
  60. data/lib/devise/omniauth.rb +2 -0
  61. data/lib/devise/orm/active_record.rb +5 -1
  62. data/lib/devise/orm/mongoid.rb +6 -2
  63. data/lib/devise/parameter_filter.rb +4 -0
  64. data/lib/devise/parameter_sanitizer.rb +139 -65
  65. data/lib/devise/rails/routes.rb +80 -61
  66. data/lib/devise/rails/warden_compat.rb +3 -10
  67. data/lib/devise/rails.rb +8 -17
  68. data/lib/devise/secret_key_finder.rb +27 -0
  69. data/lib/devise/strategies/authenticatable.rb +18 -7
  70. data/lib/devise/strategies/base.rb +2 -0
  71. data/lib/devise/strategies/database_authenticatable.rb +13 -5
  72. data/lib/devise/strategies/rememberable.rb +15 -3
  73. data/lib/devise/test/controller_helpers.rb +165 -0
  74. data/lib/devise/test/integration_helpers.rb +63 -0
  75. data/lib/devise/test_helpers.rb +7 -124
  76. data/lib/devise/time_inflector.rb +2 -0
  77. data/lib/devise/token_generator.rb +3 -41
  78. data/lib/devise/version.rb +3 -1
  79. data/lib/devise.rb +106 -79
  80. data/lib/generators/active_record/devise_generator.rb +44 -7
  81. data/lib/generators/active_record/templates/migration.rb +5 -3
  82. data/lib/generators/active_record/templates/migration_existing.rb +5 -3
  83. data/lib/generators/devise/controllers_generator.rb +46 -0
  84. data/lib/generators/devise/devise_generator.rb +4 -2
  85. data/lib/generators/devise/install_generator.rb +17 -0
  86. data/lib/generators/devise/orm_helpers.rb +10 -21
  87. data/lib/generators/devise/views_generator.rb +21 -11
  88. data/lib/generators/mongoid/devise_generator.rb +7 -5
  89. data/lib/generators/templates/README +2 -9
  90. data/lib/generators/templates/controllers/README +14 -0
  91. data/lib/generators/templates/controllers/confirmations_controller.rb +30 -0
  92. data/lib/generators/templates/controllers/omniauth_callbacks_controller.rb +30 -0
  93. data/lib/generators/templates/controllers/passwords_controller.rb +34 -0
  94. data/lib/generators/templates/controllers/registrations_controller.rb +62 -0
  95. data/lib/generators/templates/controllers/sessions_controller.rb +27 -0
  96. data/lib/generators/templates/controllers/unlocks_controller.rb +30 -0
  97. data/lib/generators/templates/devise.rb +69 -30
  98. data/lib/generators/templates/markerb/confirmation_instructions.markerb +1 -1
  99. data/lib/generators/templates/markerb/email_changed.markerb +7 -0
  100. data/lib/generators/templates/markerb/password_change.markerb +3 -0
  101. data/lib/generators/templates/markerb/reset_password_instructions.markerb +1 -1
  102. data/lib/generators/templates/markerb/unlock_instructions.markerb +1 -1
  103. data/lib/generators/templates/simple_form_for/confirmations/new.html.erb +5 -1
  104. data/lib/generators/templates/simple_form_for/passwords/edit.html.erb +10 -2
  105. data/lib/generators/templates/simple_form_for/passwords/new.html.erb +4 -1
  106. data/lib/generators/templates/simple_form_for/registrations/edit.html.erb +11 -3
  107. data/lib/generators/templates/simple_form_for/registrations/new.html.erb +11 -3
  108. data/lib/generators/templates/simple_form_for/sessions/new.html.erb +9 -4
  109. data/lib/generators/templates/simple_form_for/unlocks/new.html.erb +4 -1
  110. metadata +31 -259
  111. data/.gitignore +0 -11
  112. data/.travis.yml +0 -28
  113. data/.yardopts +0 -9
  114. data/CONTRIBUTING.md +0 -14
  115. data/Gemfile +0 -29
  116. data/Gemfile.lock +0 -160
  117. data/Rakefile +0 -35
  118. data/devise.gemspec +0 -27
  119. data/devise.png +0 -0
  120. data/gemfiles/Gemfile.rails-3.2-stable +0 -29
  121. data/gemfiles/Gemfile.rails-4.0-stable +0 -29
  122. data/gemfiles/Gemfile.rails-head +0 -29
  123. data/test/controllers/custom_strategy_test.rb +0 -62
  124. data/test/controllers/helpers_test.rb +0 -276
  125. data/test/controllers/internal_helpers_test.rb +0 -123
  126. data/test/controllers/passwords_controller_test.rb +0 -31
  127. data/test/controllers/sessions_controller_test.rb +0 -103
  128. data/test/controllers/url_helpers_test.rb +0 -59
  129. data/test/delegator_test.rb +0 -19
  130. data/test/devise_test.rb +0 -94
  131. data/test/failure_app_test.rb +0 -232
  132. data/test/generators/active_record_generator_test.rb +0 -103
  133. data/test/generators/devise_generator_test.rb +0 -39
  134. data/test/generators/install_generator_test.rb +0 -13
  135. data/test/generators/mongoid_generator_test.rb +0 -23
  136. data/test/generators/views_generator_test.rb +0 -96
  137. data/test/helpers/devise_helper_test.rb +0 -51
  138. data/test/integration/authenticatable_test.rb +0 -713
  139. data/test/integration/confirmable_test.rb +0 -284
  140. data/test/integration/database_authenticatable_test.rb +0 -84
  141. data/test/integration/http_authenticatable_test.rb +0 -105
  142. data/test/integration/lockable_test.rb +0 -239
  143. data/test/integration/omniauthable_test.rb +0 -133
  144. data/test/integration/recoverable_test.rb +0 -334
  145. data/test/integration/registerable_test.rb +0 -349
  146. data/test/integration/rememberable_test.rb +0 -167
  147. data/test/integration/timeoutable_test.rb +0 -183
  148. data/test/integration/trackable_test.rb +0 -92
  149. data/test/mailers/confirmation_instructions_test.rb +0 -115
  150. data/test/mailers/reset_password_instructions_test.rb +0 -96
  151. data/test/mailers/unlock_instructions_test.rb +0 -91
  152. data/test/mapping_test.rb +0 -127
  153. data/test/models/authenticatable_test.rb +0 -13
  154. data/test/models/confirmable_test.rb +0 -454
  155. data/test/models/database_authenticatable_test.rb +0 -249
  156. data/test/models/lockable_test.rb +0 -316
  157. data/test/models/omniauthable_test.rb +0 -7
  158. data/test/models/recoverable_test.rb +0 -184
  159. data/test/models/registerable_test.rb +0 -7
  160. data/test/models/rememberable_test.rb +0 -183
  161. data/test/models/serializable_test.rb +0 -49
  162. data/test/models/timeoutable_test.rb +0 -51
  163. data/test/models/trackable_test.rb +0 -13
  164. data/test/models/validatable_test.rb +0 -127
  165. data/test/models_test.rb +0 -144
  166. data/test/omniauth/config_test.rb +0 -57
  167. data/test/omniauth/url_helpers_test.rb +0 -54
  168. data/test/orm/active_record.rb +0 -10
  169. data/test/orm/mongoid.rb +0 -13
  170. data/test/parameter_sanitizer_test.rb +0 -81
  171. data/test/rails_app/Rakefile +0 -6
  172. data/test/rails_app/app/active_record/admin.rb +0 -6
  173. data/test/rails_app/app/active_record/shim.rb +0 -2
  174. data/test/rails_app/app/active_record/user.rb +0 -6
  175. data/test/rails_app/app/controllers/admins/sessions_controller.rb +0 -6
  176. data/test/rails_app/app/controllers/admins_controller.rb +0 -11
  177. data/test/rails_app/app/controllers/application_controller.rb +0 -9
  178. data/test/rails_app/app/controllers/home_controller.rb +0 -25
  179. data/test/rails_app/app/controllers/publisher/registrations_controller.rb +0 -2
  180. data/test/rails_app/app/controllers/publisher/sessions_controller.rb +0 -2
  181. data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +0 -14
  182. data/test/rails_app/app/controllers/users_controller.rb +0 -31
  183. data/test/rails_app/app/helpers/application_helper.rb +0 -3
  184. data/test/rails_app/app/mailers/users/mailer.rb +0 -12
  185. data/test/rails_app/app/mongoid/admin.rb +0 -29
  186. data/test/rails_app/app/mongoid/shim.rb +0 -23
  187. data/test/rails_app/app/mongoid/user.rb +0 -39
  188. data/test/rails_app/app/views/admins/index.html.erb +0 -1
  189. data/test/rails_app/app/views/admins/sessions/new.html.erb +0 -2
  190. data/test/rails_app/app/views/home/admin_dashboard.html.erb +0 -1
  191. data/test/rails_app/app/views/home/index.html.erb +0 -1
  192. data/test/rails_app/app/views/home/join.html.erb +0 -1
  193. data/test/rails_app/app/views/home/private.html.erb +0 -1
  194. data/test/rails_app/app/views/home/user_dashboard.html.erb +0 -1
  195. data/test/rails_app/app/views/layouts/application.html.erb +0 -24
  196. data/test/rails_app/app/views/users/edit_form.html.erb +0 -1
  197. data/test/rails_app/app/views/users/index.html.erb +0 -1
  198. data/test/rails_app/app/views/users/mailer/confirmation_instructions.erb +0 -1
  199. data/test/rails_app/app/views/users/sessions/new.html.erb +0 -1
  200. data/test/rails_app/bin/bundle +0 -3
  201. data/test/rails_app/bin/rails +0 -4
  202. data/test/rails_app/bin/rake +0 -4
  203. data/test/rails_app/config/application.rb +0 -40
  204. data/test/rails_app/config/boot.rb +0 -14
  205. data/test/rails_app/config/database.yml +0 -18
  206. data/test/rails_app/config/environment.rb +0 -5
  207. data/test/rails_app/config/environments/development.rb +0 -30
  208. data/test/rails_app/config/environments/production.rb +0 -80
  209. data/test/rails_app/config/environments/test.rb +0 -36
  210. data/test/rails_app/config/initializers/backtrace_silencers.rb +0 -7
  211. data/test/rails_app/config/initializers/devise.rb +0 -181
  212. data/test/rails_app/config/initializers/inflections.rb +0 -2
  213. data/test/rails_app/config/initializers/secret_token.rb +0 -8
  214. data/test/rails_app/config/initializers/session_store.rb +0 -1
  215. data/test/rails_app/config/routes.rb +0 -105
  216. data/test/rails_app/config.ru +0 -4
  217. data/test/rails_app/db/migrate/20100401102949_create_tables.rb +0 -71
  218. data/test/rails_app/db/schema.rb +0 -55
  219. data/test/rails_app/lib/shared_admin.rb +0 -17
  220. data/test/rails_app/lib/shared_user.rb +0 -29
  221. data/test/rails_app/public/404.html +0 -26
  222. data/test/rails_app/public/422.html +0 -26
  223. data/test/rails_app/public/500.html +0 -26
  224. data/test/rails_app/public/favicon.ico +0 -0
  225. data/test/routes_test.rb +0 -262
  226. data/test/support/action_controller/record_identifier.rb +0 -10
  227. data/test/support/assertions.rb +0 -40
  228. data/test/support/helpers.rb +0 -70
  229. data/test/support/integration.rb +0 -92
  230. data/test/support/locale/en.yml +0 -8
  231. data/test/support/mongoid.yml +0 -6
  232. data/test/support/webrat/integrations/rails.rb +0 -24
  233. data/test/test_helper.rb +0 -27
  234. data/test/test_helpers_test.rb +0 -173
  235. data/test/test_models.rb +0 -33
@@ -1 +0,0 @@
1
- <%= @resource.email %>
@@ -1 +0,0 @@
1
- Special user view
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
- load Gem.bin_path('bundler', 'bundle')
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../../config/application', __FILE__)
3
- require_relative '../config/boot'
4
- require 'rails/commands'
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require_relative '../config/boot'
3
- require 'rake'
4
- Rake.application.run
@@ -1,40 +0,0 @@
1
- require File.expand_path('../boot', __FILE__)
2
-
3
- require "action_controller/railtie"
4
- require "action_mailer/railtie"
5
- require "rails/test_unit/railtie"
6
-
7
- Bundler.require :default, DEVISE_ORM
8
-
9
- begin
10
- require "#{DEVISE_ORM}/railtie"
11
- rescue LoadError
12
- end
13
-
14
- require "devise"
15
-
16
- module RailsApp
17
- class Application < Rails::Application
18
- # Add additional load paths for your own custom dirs
19
- config.autoload_paths.reject!{ |p| p =~ /\/app\/(\w+)$/ && !%w(controllers helpers mailers views).include?($1) }
20
- config.autoload_paths += [ "#{config.root}/app/#{DEVISE_ORM}" ]
21
-
22
- # Configure generators values. Many other options are available, be sure to check the documentation.
23
- # config.generators do |g|
24
- # g.orm :active_record
25
- # g.template_engine :erb
26
- # g.test_framework :test_unit, fixture: true
27
- # end
28
-
29
- # Configure sensitive parameters which will be filtered from the log file.
30
- config.filter_parameters << :password
31
- config.assets.enabled = false
32
-
33
- config.action_mailer.default_url_options = { host: "localhost:3000" }
34
-
35
- # This was used to break devise in some situations
36
- config.to_prepare do
37
- Devise::SessionsController.layout "application"
38
- end
39
- end
40
- end
@@ -1,14 +0,0 @@
1
- unless defined?(DEVISE_ORM)
2
- DEVISE_ORM = (ENV["DEVISE_ORM"] || :active_record).to_sym
3
- end
4
-
5
- module Devise
6
- # Detection for minor differences between Rails 3.2 and 4 in tests.
7
- def self.rails4?
8
- Rails.version.start_with? '4'
9
- end
10
- end
11
-
12
- # Set up gems listed in the Gemfile.
13
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
14
- require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -1,18 +0,0 @@
1
- # SQLite version 3.x
2
- # gem install sqlite3-ruby (not necessary on OS X Leopard)
3
- development:
4
- adapter: sqlite3
5
- database: db/development.sqlite3
6
- pool: 5
7
- timeout: 5000
8
-
9
- # Warning: The database defined as "test" will be erased and
10
- # re-generated from your development database when you run "rake".
11
- # Do not set this db to the same as development or production.
12
- test:
13
- adapter: sqlite3
14
- database: ":memory:"
15
-
16
- production:
17
- adapter: sqlite3
18
- database: ":memory:"
@@ -1,5 +0,0 @@
1
- # Load the rails application.
2
- require File.expand_path('../application', __FILE__)
3
-
4
- # Initialize the rails application.
5
- RailsApp::Application.initialize!
@@ -1,30 +0,0 @@
1
- RailsApp::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
3
-
4
- # In the development environment your application's code is reloaded on
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.
7
- config.cache_classes = false
8
-
9
- # Do not eager load code on boot.
10
- config.eager_load = false
11
-
12
- # Show full error reports and disable caching.
13
- config.consider_all_requests_local = true
14
- config.action_controller.perform_caching = false
15
-
16
- # Don't care if the mailer can't send.
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
- # Raise an error on page load if there are pending migrations
26
- config.active_record.migration_error = :page_load
27
-
28
- # Debug mode disables concatenation and preprocessing of assets.
29
- config.assets.debug = true
30
- end
@@ -1,80 +0,0 @@
1
- RailsApp::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
3
-
4
- # Code is not reloaded between requests.
5
- config.cache_classes = true
6
-
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.
14
- config.consider_all_requests_local = false
15
- config.action_controller.perform_caching = true
16
-
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
21
-
22
- # Disable Rails's static asset server (Apache or nginx will already do this).
23
- config.serve_static_assets = false
24
-
25
- # Compress JavaScripts and CSS.
26
- config.assets.js_compressor = :uglifier
27
- # config.assets.css_compressor = :sass
28
-
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
47
-
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.
58
- # config.action_controller.asset_host = "http://assets.example.com"
59
-
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.
66
- # config.action_mailer.raise_delivery_errors = false
67
-
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
- # Disable automatic flushing of the log to improve performance.
76
- # config.autoflush_log = false
77
-
78
- # Use default logging formatter so that PID and timestamp are not suppressed.
79
- config.log_formatter = ::Logger::Formatter.new
80
- end
@@ -1,36 +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
- # 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.
20
- config.consider_all_requests_local = true
21
- config.action_controller.perform_caching = false
22
-
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
28
-
29
- # Tell Action Mailer not to deliver emails to the real world.
30
- # The :test delivery method accumulates sent emails in the
31
- # ActionMailer::Base.deliveries array.
32
- config.action_mailer.delivery_method = :test
33
-
34
- # Print deprecation notices to the stderr.
35
- config.active_support.deprecation = :stderr
36
- 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,181 +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
- # Configure the class responsible to send e-mails.
16
- # config.mailer = "Devise::Mailer"
17
-
18
- # ==> ORM configuration
19
- # Load and configure the ORM. Supports :active_record (default) and
20
- # :mongoid (bson_ext recommended) by default. Other ORMs may be
21
- # available as additional gems.
22
- require "devise/orm/#{DEVISE_ORM}"
23
-
24
- # ==> Configuration for any authentication mechanism
25
- # Configure which keys are used when authenticating a user. By default is
26
- # just :email. You can configure it to use [:username, :subdomain], so for
27
- # authenticating a user, both parameters are required. Remember that those
28
- # parameters are used only when authenticating and not when retrieving from
29
- # session. If you need permissions, you should implement that in a before filter.
30
- # You can also supply hash where the value is a boolean expliciting if authentication
31
- # should be aborted or not if the value is not present. By default is empty.
32
- # config.authentication_keys = [ :email ]
33
-
34
- # Configure parameters from the request object used for authentication. Each entry
35
- # given should be a request method and it will automatically be passed to
36
- # find_for_authentication method and considered in your model lookup. For instance,
37
- # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
38
- # The same considerations mentioned for authentication_keys also apply to request_keys.
39
- # config.request_keys = []
40
-
41
- # Configure which authentication keys should be case-insensitive.
42
- # These keys will be downcased upon creating or modifying a user and when used
43
- # to authenticate or find a user. Default is :email.
44
- config.case_insensitive_keys = [ :email ]
45
-
46
- # Configure which authentication keys should have whitespace stripped.
47
- # These keys will have whitespace before and after removed upon creating or
48
- # modifying a user and when used to authenticate or find a user. Default is :email.
49
- config.strip_whitespace_keys = [ :email ]
50
-
51
- # Tell if authentication through request.params is enabled. True by default.
52
- # config.params_authenticatable = true
53
-
54
- # Tell if authentication through HTTP Basic Auth is enabled. False by default.
55
- config.http_authenticatable = true
56
-
57
- # If http headers should be returned for AJAX requests. True by default.
58
- # config.http_authenticatable_on_xhr = true
59
-
60
- # The realm used in Http Basic Authentication. "Application" by default.
61
- # config.http_authentication_realm = "Application"
62
-
63
- # ==> Configuration for :database_authenticatable
64
- # For bcrypt, this is the cost for hashing the password and defaults to 10. If
65
- # using other encryptors, it sets how many times you want the password re-encrypted.
66
- config.stretches = Rails.env.test? ? 1 : 10
67
-
68
- # ==> Configuration for :confirmable
69
- # The time you want to give your user to confirm their account. During this time
70
- # they will be able to access your application without confirming. Default is nil.
71
- # When allow_unconfirmed_access_for is zero, the user won't be able to sign in without confirming.
72
- # You can use this to let your user access some features of your application
73
- # without confirming the account, but blocking it after a certain period
74
- # (ie 2 days).
75
- # config.allow_unconfirmed_access_for = 2.days
76
-
77
- # Defines which key will be used when confirming an account
78
- # config.confirmation_keys = [ :email ]
79
-
80
- # ==> Configuration for :rememberable
81
- # The time the user will be remembered without asking for credentials again.
82
- # config.remember_for = 2.weeks
83
-
84
- # If true, a valid remember token can be re-used between multiple browsers.
85
- # config.remember_across_browsers = true
86
-
87
- # If true, extends the user's remember period when remembered via cookie.
88
- # config.extend_remember_period = false
89
-
90
- # ==> Configuration for :validatable
91
- # Range for password length. Default is 8..128.
92
- # config.password_length = 8..128
93
-
94
- # Regex to use to validate the email address
95
- # config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
96
-
97
- # ==> Configuration for :timeoutable
98
- # The time you want to timeout the user session without activity. After this
99
- # time the user will be asked for credentials again. Default is 30 minutes.
100
- # config.timeout_in = 30.minutes
101
-
102
- # ==> Configuration for :lockable
103
- # Defines which strategy will be used to lock an account.
104
- # :failed_attempts = Locks an account after a number of failed attempts to sign in.
105
- # :none = No lock strategy. You should handle locking by yourself.
106
- # config.lock_strategy = :failed_attempts
107
-
108
- # Defines which key will be used when locking and unlocking an account
109
- # config.unlock_keys = [ :email ]
110
-
111
- # Defines which strategy will be used to unlock an account.
112
- # :email = Sends an unlock link to the user email
113
- # :time = Re-enables login after a certain amount of time (see :unlock_in below)
114
- # :both = Enables both strategies
115
- # :none = No unlock strategy. You should handle unlocking by yourself.
116
- # config.unlock_strategy = :both
117
-
118
- # Number of authentication tries before locking an account if lock_strategy
119
- # is failed attempts.
120
- # config.maximum_attempts = 20
121
-
122
- # Time interval to unlock the account if :time is enabled as unlock_strategy.
123
- # config.unlock_in = 1.hour
124
-
125
- # ==> Configuration for :recoverable
126
- #
127
- # Defines which key will be used when recovering the password for an account
128
- # config.reset_password_keys = [ :email ]
129
-
130
- # Time interval you can reset your password with a reset password key.
131
- # Don't put a too small interval or your users won't have the time to
132
- # change their passwords.
133
- config.reset_password_within = 2.hours
134
-
135
- # Setup a pepper to generate the encrypted password.
136
- config.pepper = "d142367154e5beacca404b1a6a4f8bc52c6fdcfa3ccc3cf8eb49f3458a688ee6ac3b9fae488432a3bfca863b8a90008368a9f3a3dfbe5a962e64b6ab8f3a3a1a"
137
-
138
- # ==> Configuration for :token_authenticatable
139
- # Defines name of the authentication token params key
140
- # config.token_authentication_key = :auth_token
141
-
142
- # ==> Scopes configuration
143
- # Turn scoped views on. Before rendering "sessions/new", it will first check for
144
- # "users/sessions/new". It's turned off by default because it's slower if you
145
- # are using only default views.
146
- # config.scoped_views = false
147
-
148
- # Configure the default scope given to Warden. By default it's the first
149
- # devise role declared in your routes (usually :user).
150
- # config.default_scope = :user
151
-
152
- # Configure sign_out behavior.
153
- # Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
154
- # The default is true, which means any logout action will sign out all active scopes.
155
- # config.sign_out_all_scopes = true
156
-
157
- # ==> Navigation configuration
158
- # Lists the formats that should be treated as navigational. Formats like
159
- # :html, should redirect to the sign in page when the user does not have
160
- # access, but formats like :xml or :json, should return 401.
161
- # If you have any extra navigational formats, like :iphone or :mobile, you
162
- # should add them to the navigational formats lists. Default is [:html]
163
- # config.navigational_formats = [:html, :iphone]
164
-
165
- # The default HTTP method used to sign out a resource. Default is :get.
166
- # config.sign_out_via = :get
167
-
168
- # ==> OmniAuth
169
- config.omniauth :facebook, 'APP_ID', 'APP_SECRET', scope: 'email,offline_access'
170
- config.omniauth :openid
171
- config.omniauth :openid, name: 'google', identifier: 'https://www.google.com/accounts/o8/id'
172
-
173
- # ==> Warden configuration
174
- # If you want to use other strategies, that are not supported by Devise, or
175
- # change the failure app, you can configure them inside the config.warden block.
176
- #
177
- # config.warden do |manager|
178
- # manager.failure_app = AnotherApp
179
- # manager.default_strategies(scope: :user).unshift :some_external_strategy
180
- # end
181
- end
@@ -1,2 +0,0 @@
1
- ActiveSupport::Inflector.inflections do |inflect|
2
- end
@@ -1,8 +0,0 @@
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
@@ -1 +0,0 @@
1
- RailsApp::Application.config.session_store :cookie_store, key: '_rails_app_session'
@@ -1,105 +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] do
17
- get :expire, on: :member
18
- end
19
-
20
- # Users scope
21
- devise_for :users, controllers: { omniauth_callbacks: "users/omniauth_callbacks" }
22
-
23
- as :user do
24
- get "/as/sign_in", to: "devise/sessions#new"
25
- end
26
-
27
- get "/sign_in", to: "devise/sessions#new"
28
-
29
- # Admin scope
30
- devise_for :admin, path: "admin_area", controllers: { sessions: :"admins/sessions" }, skip: :passwords
31
-
32
- get "/admin_area/home", to: "admins#index", as: :admin_root
33
- get "/anywhere", to: "foo#bar", as: :new_admin_password
34
-
35
- authenticate(:admin) do
36
- get "/private", to: "home#private", as: :private
37
- end
38
-
39
- authenticate(:admin, lambda { |admin| admin.active? }) do
40
- get "/private/active", to: "home#private", as: :private_active
41
- end
42
-
43
- authenticated :admin do
44
- get "/dashboard", to: "home#admin_dashboard"
45
- end
46
-
47
- authenticated :admin, lambda { |admin| admin.active? } do
48
- get "/dashboard/active", to: "home#admin_dashboard"
49
- end
50
-
51
- authenticated do
52
- get "/dashboard", to: "home#user_dashboard"
53
- end
54
-
55
- unauthenticated do
56
- get "/join", to: "home#join"
57
- end
58
-
59
- # Routes for constraints testing
60
- devise_for :headquarters_admin, class_name: "Admin", path: "headquarters", constraints: {host: /192\.168\.1\.\d\d\d/}
61
-
62
- constraints(host: /192\.168\.1\.\d\d\d/) do
63
- devise_for :homebase_admin, class_name: "Admin", path: "homebase"
64
- end
65
-
66
- devise_for :skip_admin, class_name: "Admin", skip: :all
67
-
68
- # Routes for format=false testing
69
- devise_for :htmlonly_admin, class_name: "Admin", skip: [:confirmations, :unlocks], path: "htmlonly_admin", format: false, skip_helpers: [:confirmations, :unlocks]
70
- devise_for :htmlonly_users, class_name: "User", only: [:confirmations, :unlocks], path: "htmlonly_users", format: false, skip_helpers: true
71
-
72
- # Other routes for routing_test.rb
73
- devise_for :reader, class_name: "User", only: :passwords
74
-
75
- scope host: "sub.example.com" do
76
- devise_for :sub_admin, class_name: "Admin"
77
- end
78
-
79
- namespace :publisher, path_names: { sign_in: "i_dont_care", sign_out: "get_out" } do
80
- devise_for :accounts, class_name: "Admin", path_names: { sign_in: "get_in" }
81
- end
82
-
83
- scope ":locale", module: :invalid do
84
- devise_for :accounts, singular: "manager", class_name: "Admin",
85
- path_names: {
86
- sign_in: "login", sign_out: "logout",
87
- password: "secret", confirmation: "verification",
88
- unlock: "unblock", sign_up: "register",
89
- registration: "management",
90
- cancel: "giveup", edit: "edit/profile"
91
- }, failure_app: lambda { |env| [404, {"Content-Type" => "text/plain"}, ["Oops, not found"]] }, module: :devise
92
- end
93
-
94
- namespace :sign_out_via, module: "devise" do
95
- devise_for :deletes, sign_out_via: :delete, class_name: "Admin"
96
- devise_for :posts, sign_out_via: :post, class_name: "Admin"
97
- devise_for :delete_or_posts, sign_out_via: [:delete, :post], class_name: "Admin"
98
- end
99
-
100
- get "/set", to: "home#set"
101
- get "/unauthenticated", to: "home#unauthenticated"
102
- get "/custom_strategy/new"
103
-
104
- root to: "home#index", via: [:get, :post]
105
- end
@@ -1,4 +0,0 @@
1
- # This file is used by Rack-based servers to start the application.
2
-
3
- require ::File.expand_path('../config/environment', __FILE__)
4
- run RailsApp::Application
@@ -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
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
64
- end
65
- end
66
-
67
- def self.down
68
- drop_table :users
69
- drop_table :admins
70
- end
71
- end