devise 2.1.2 → 3.5.10

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of devise might be problematic. Click here for more details.

Files changed (242) hide show
  1. checksums.yaml +7 -0
  2. data/.travis.yml +39 -10
  3. data/.yardopts +9 -0
  4. data/{CHANGELOG.rdoc → CHANGELOG.md} +445 -112
  5. data/CODE_OF_CONDUCT.md +22 -0
  6. data/CONTRIBUTING.md +16 -0
  7. data/Gemfile +10 -15
  8. data/Gemfile.lock +151 -129
  9. data/MIT-LICENSE +1 -1
  10. data/README.md +256 -96
  11. data/Rakefile +4 -2
  12. data/app/controllers/devise/confirmations_controller.rb +15 -7
  13. data/app/controllers/devise/omniauth_callbacks_controller.rb +6 -2
  14. data/app/controllers/devise/passwords_controller.rb +33 -9
  15. data/app/controllers/devise/registrations_controller.rb +66 -26
  16. data/app/controllers/devise/sessions_controller.rb +52 -21
  17. data/app/controllers/devise/unlocks_controller.rb +11 -6
  18. data/app/controllers/devise_controller.rb +65 -58
  19. data/app/helpers/devise_helper.rb +2 -2
  20. data/app/mailers/devise/mailer.rb +19 -10
  21. data/app/views/devise/confirmations/new.html.erb +8 -4
  22. data/app/views/devise/mailer/confirmation_instructions.html.erb +2 -2
  23. data/app/views/devise/mailer/password_change.html.erb +3 -0
  24. data/app/views/devise/mailer/reset_password_instructions.html.erb +2 -2
  25. data/app/views/devise/mailer/unlock_instructions.html.erb +2 -2
  26. data/app/views/devise/passwords/edit.html.erb +15 -6
  27. data/app/views/devise/passwords/new.html.erb +8 -4
  28. data/app/views/devise/registrations/edit.html.erb +29 -15
  29. data/app/views/devise/registrations/new.html.erb +19 -8
  30. data/app/views/devise/sessions/new.html.erb +17 -8
  31. data/app/views/devise/shared/{_links.erb → _links.html.erb} +4 -4
  32. data/app/views/devise/unlocks/new.html.erb +8 -4
  33. data/config/locales/en.yml +51 -47
  34. data/devise.gemspec +8 -6
  35. data/devise.png +0 -0
  36. data/gemfiles/Gemfile.rails-3.2-stable +29 -0
  37. data/gemfiles/Gemfile.rails-3.2-stable.lock +172 -0
  38. data/gemfiles/Gemfile.rails-4.0-stable +30 -0
  39. data/gemfiles/Gemfile.rails-4.0-stable.lock +166 -0
  40. data/gemfiles/Gemfile.rails-4.1-stable +30 -0
  41. data/gemfiles/Gemfile.rails-4.1-stable.lock +171 -0
  42. data/gemfiles/Gemfile.rails-4.2-stable +30 -0
  43. data/gemfiles/Gemfile.rails-4.2-stable.lock +193 -0
  44. data/lib/devise/controllers/helpers.rb +126 -108
  45. data/lib/devise/controllers/rememberable.rb +19 -17
  46. data/lib/devise/controllers/scoped_views.rb +1 -1
  47. data/lib/devise/controllers/sign_in_out.rb +96 -0
  48. data/lib/devise/controllers/store_location.rb +58 -0
  49. data/lib/devise/controllers/url_helpers.rb +7 -7
  50. data/lib/devise/encryptor.rb +22 -0
  51. data/lib/devise/failure_app.rb +85 -25
  52. data/lib/devise/hooks/activatable.rb +5 -6
  53. data/lib/devise/hooks/csrf_cleaner.rb +7 -0
  54. data/lib/devise/hooks/forgetable.rb +1 -1
  55. data/lib/devise/hooks/lockable.rb +2 -2
  56. data/lib/devise/hooks/proxy.rb +21 -0
  57. data/lib/devise/hooks/rememberable.rb +5 -4
  58. data/lib/devise/hooks/timeoutable.rb +16 -8
  59. data/lib/devise/hooks/trackable.rb +1 -1
  60. data/lib/devise/mailers/helpers.rb +27 -23
  61. data/lib/devise/mapping.rb +11 -7
  62. data/lib/devise/models/authenticatable.rb +82 -66
  63. data/lib/devise/models/confirmable.rb +142 -55
  64. data/lib/devise/models/database_authenticatable.rb +59 -15
  65. data/lib/devise/models/lockable.rb +41 -30
  66. data/lib/devise/models/omniauthable.rb +3 -3
  67. data/lib/devise/models/recoverable.rb +56 -41
  68. data/lib/devise/models/rememberable.rb +65 -27
  69. data/lib/devise/models/timeoutable.rb +2 -8
  70. data/lib/devise/models/trackable.rb +6 -4
  71. data/lib/devise/models/validatable.rb +9 -9
  72. data/lib/devise/models.rb +4 -13
  73. data/lib/devise/modules.rb +10 -11
  74. data/lib/devise/omniauth/url_helpers.rb +2 -2
  75. data/lib/devise/orm/active_record.rb +1 -1
  76. data/lib/devise/orm/mongoid.rb +1 -1
  77. data/lib/devise/{param_filter.rb → parameter_filter.rb} +10 -11
  78. data/lib/devise/parameter_sanitizer.rb +99 -0
  79. data/lib/devise/rails/routes.rb +173 -115
  80. data/lib/devise/rails/warden_compat.rb +10 -31
  81. data/lib/devise/rails.rb +14 -12
  82. data/lib/devise/strategies/authenticatable.rb +26 -26
  83. data/lib/devise/strategies/base.rb +1 -1
  84. data/lib/devise/strategies/database_authenticatable.rb +8 -4
  85. data/lib/devise/strategies/rememberable.rb +15 -5
  86. data/lib/devise/test_helpers.rb +7 -5
  87. data/lib/devise/time_inflector.rb +14 -0
  88. data/lib/devise/token_generator.rb +70 -0
  89. data/lib/devise/version.rb +1 -1
  90. data/lib/devise.rb +110 -52
  91. data/lib/generators/active_record/devise_generator.rb +34 -18
  92. data/lib/generators/active_record/templates/migration.rb +5 -6
  93. data/lib/generators/active_record/templates/migration_existing.rb +5 -6
  94. data/lib/generators/devise/controllers_generator.rb +44 -0
  95. data/lib/generators/devise/devise_generator.rb +5 -3
  96. data/lib/generators/devise/install_generator.rb +5 -0
  97. data/lib/generators/devise/orm_helpers.rb +25 -6
  98. data/lib/generators/devise/views_generator.rb +52 -22
  99. data/lib/generators/mongoid/devise_generator.rb +21 -26
  100. data/lib/generators/templates/README +9 -5
  101. data/lib/generators/templates/controllers/README +14 -0
  102. data/lib/generators/templates/controllers/confirmations_controller.rb +28 -0
  103. data/lib/generators/templates/controllers/omniauth_callbacks_controller.rb +28 -0
  104. data/lib/generators/templates/controllers/passwords_controller.rb +32 -0
  105. data/lib/generators/templates/controllers/registrations_controller.rb +60 -0
  106. data/lib/generators/templates/controllers/sessions_controller.rb +25 -0
  107. data/lib/generators/templates/controllers/unlocks_controller.rb +28 -0
  108. data/lib/generators/templates/devise.rb +80 -43
  109. data/lib/generators/templates/markerb/confirmation_instructions.markerb +2 -2
  110. data/lib/generators/templates/markerb/password_change.markerb +3 -0
  111. data/lib/generators/templates/markerb/reset_password_instructions.markerb +1 -1
  112. data/lib/generators/templates/markerb/unlock_instructions.markerb +2 -2
  113. data/lib/generators/templates/simple_form_for/confirmations/new.html.erb +3 -2
  114. data/lib/generators/templates/simple_form_for/passwords/edit.html.erb +4 -4
  115. data/lib/generators/templates/simple_form_for/passwords/new.html.erb +2 -2
  116. data/lib/generators/templates/simple_form_for/registrations/edit.html.erb +11 -6
  117. data/lib/generators/templates/simple_form_for/registrations/new.html.erb +4 -4
  118. data/lib/generators/templates/simple_form_for/sessions/new.html.erb +6 -6
  119. data/lib/generators/templates/simple_form_for/unlocks/new.html.erb +3 -2
  120. data/script/cached-bundle +49 -0
  121. data/script/s3-put +71 -0
  122. data/test/controllers/custom_registrations_controller_test.rb +40 -0
  123. data/test/controllers/helper_methods_test.rb +21 -0
  124. data/test/controllers/helpers_test.rb +95 -32
  125. data/test/controllers/inherited_controller_i18n_messages_test.rb +51 -0
  126. data/test/controllers/internal_helpers_test.rb +39 -14
  127. data/test/controllers/load_hooks_controller_test.rb +19 -0
  128. data/test/controllers/passwords_controller_test.rb +31 -0
  129. data/test/controllers/sessions_controller_test.rb +66 -6
  130. data/test/controllers/url_helpers_test.rb +10 -4
  131. data/test/delegator_test.rb +1 -1
  132. data/test/devise_test.rb +45 -10
  133. data/test/failure_app_test.rb +121 -27
  134. data/test/generators/active_record_generator_test.rb +48 -8
  135. data/test/generators/controllers_generator_test.rb +48 -0
  136. data/test/generators/devise_generator_test.rb +2 -2
  137. data/test/generators/mongoid_generator_test.rb +3 -3
  138. data/test/generators/views_generator_test.rb +54 -3
  139. data/test/helpers/devise_helper_test.rb +18 -20
  140. data/test/integration/authenticatable_test.rb +161 -65
  141. data/test/integration/confirmable_test.rb +146 -77
  142. data/test/integration/database_authenticatable_test.rb +43 -30
  143. data/test/integration/http_authenticatable_test.rb +30 -22
  144. data/test/integration/lockable_test.rb +64 -49
  145. data/test/integration/omniauthable_test.rb +17 -15
  146. data/test/integration/recoverable_test.rb +111 -70
  147. data/test/integration/registerable_test.rb +114 -79
  148. data/test/integration/rememberable_test.rb +87 -31
  149. data/test/integration/timeoutable_test.rb +77 -33
  150. data/test/integration/trackable_test.rb +5 -5
  151. data/test/mailers/confirmation_instructions_test.rb +28 -8
  152. data/test/mailers/reset_password_instructions_test.rb +21 -8
  153. data/test/mailers/unlock_instructions_test.rb +20 -6
  154. data/test/mapping_test.rb +12 -5
  155. data/test/models/authenticatable_test.rb +17 -1
  156. data/test/models/confirmable_test.rb +216 -62
  157. data/test/models/database_authenticatable_test.rb +129 -49
  158. data/test/models/lockable_test.rb +132 -45
  159. data/test/models/recoverable_test.rb +100 -54
  160. data/test/models/rememberable_test.rb +89 -94
  161. data/test/models/serializable_test.rb +12 -11
  162. data/test/models/timeoutable_test.rb +6 -1
  163. data/test/models/trackable_test.rb +28 -0
  164. data/test/models/validatable_test.rb +31 -21
  165. data/test/models_test.rb +22 -48
  166. data/test/omniauth/config_test.rb +4 -4
  167. data/test/omniauth/url_helpers_test.rb +7 -4
  168. data/test/orm/active_record.rb +1 -0
  169. data/test/orm/mongoid.rb +2 -3
  170. data/test/parameter_sanitizer_test.rb +81 -0
  171. data/test/rails_app/Rakefile +0 -4
  172. data/test/rails_app/app/active_record/shim.rb +1 -1
  173. data/test/rails_app/app/active_record/user_on_engine.rb +7 -0
  174. data/test/rails_app/app/active_record/user_on_main_app.rb +7 -0
  175. data/test/rails_app/app/active_record/user_without_email.rb +8 -0
  176. data/test/rails_app/app/controllers/admins/sessions_controller.rb +1 -1
  177. data/test/rails_app/app/controllers/admins_controller.rb +0 -5
  178. data/test/rails_app/app/controllers/application_controller.rb +6 -2
  179. data/test/rails_app/app/controllers/application_with_fake_engine.rb +30 -0
  180. data/test/rails_app/app/controllers/custom/registrations_controller.rb +31 -0
  181. data/test/rails_app/app/controllers/home_controller.rb +1 -1
  182. data/test/rails_app/app/controllers/publisher/registrations_controller.rb +1 -1
  183. data/test/rails_app/app/controllers/publisher/sessions_controller.rb +1 -1
  184. data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +4 -4
  185. data/test/rails_app/app/controllers/users_controller.rb +12 -4
  186. data/test/rails_app/app/mailers/users/from_proc_mailer.rb +3 -0
  187. data/test/rails_app/app/mailers/users/mailer.rb +1 -1
  188. data/test/rails_app/app/mailers/users/reply_to_mailer.rb +4 -0
  189. data/test/rails_app/app/mongoid/admin.rb +12 -10
  190. data/test/rails_app/app/mongoid/shim.rb +4 -5
  191. data/test/rails_app/app/mongoid/user.rb +19 -22
  192. data/test/rails_app/app/mongoid/user_on_engine.rb +39 -0
  193. data/test/rails_app/app/mongoid/user_on_main_app.rb +39 -0
  194. data/test/rails_app/app/mongoid/user_without_email.rb +33 -0
  195. data/test/rails_app/app/views/admins/sessions/new.html.erb +1 -1
  196. data/test/rails_app/app/views/home/admin_dashboard.html.erb +1 -1
  197. data/test/rails_app/app/views/home/index.html.erb +1 -1
  198. data/test/rails_app/app/views/home/join.html.erb +1 -1
  199. data/test/rails_app/app/views/home/user_dashboard.html.erb +1 -1
  200. data/test/rails_app/app/views/layouts/application.html.erb +1 -1
  201. data/test/rails_app/app/views/users/edit_form.html.erb +1 -0
  202. data/test/rails_app/bin/bundle +3 -0
  203. data/test/rails_app/bin/rails +4 -0
  204. data/test/rails_app/bin/rake +4 -0
  205. data/test/rails_app/config/application.rb +4 -5
  206. data/test/rails_app/config/boot.rb +9 -3
  207. data/test/rails_app/config/environment.rb +2 -2
  208. data/test/rails_app/config/environments/development.rb +19 -7
  209. data/test/rails_app/config/environments/production.rb +68 -17
  210. data/test/rails_app/config/environments/test.rb +24 -16
  211. data/test/rails_app/config/initializers/devise.rb +22 -20
  212. data/test/rails_app/config/initializers/secret_token.rb +8 -2
  213. data/test/rails_app/config/initializers/session_store.rb +1 -0
  214. data/test/rails_app/config/routes.rb +71 -46
  215. data/test/rails_app/db/migrate/20100401102949_create_tables.rb +9 -12
  216. data/test/rails_app/db/schema.rb +21 -18
  217. data/test/rails_app/lib/shared_admin.rb +7 -4
  218. data/test/rails_app/lib/shared_user.rb +6 -3
  219. data/test/rails_app/lib/shared_user_without_email.rb +26 -0
  220. data/test/rails_app/lib/shared_user_without_omniauth.rb +13 -0
  221. data/test/rails_test.rb +9 -0
  222. data/test/routes_test.rb +94 -78
  223. data/test/support/action_controller/record_identifier.rb +10 -0
  224. data/test/support/assertions.rb +2 -3
  225. data/test/support/helpers.rb +18 -32
  226. data/test/support/integration.rb +17 -16
  227. data/test/support/locale/en.yml +4 -0
  228. data/test/support/mongoid.yml +6 -0
  229. data/test/test_helper.rb +8 -1
  230. data/test/test_helpers_test.rb +64 -20
  231. data/test/test_models.rb +33 -0
  232. data/test/time_helpers.rb +137 -0
  233. metadata +172 -51
  234. data/app/views/devise/_links.erb +0 -3
  235. data/gemfiles/Gemfile.rails-3.1.x +0 -35
  236. data/gemfiles/Gemfile.rails-3.1.x.lock +0 -167
  237. data/lib/devise/models/token_authenticatable.rb +0 -77
  238. data/lib/devise/strategies/token_authenticatable.rb +0 -56
  239. data/test/indifferent_hash.rb +0 -33
  240. data/test/integration/token_authenticatable_test.rb +0 -161
  241. data/test/models/token_authenticatable_test.rb +0 -55
  242. data/test/rails_app/script/rails +0 -10
@@ -1,2 +1,2 @@
1
1
  Welcome to "sessions/new" view!
2
- <%= render :file => "devise/sessions/new" %>
2
+ <%= render file: "devise/sessions/new" %>
@@ -1 +1 @@
1
- Admin dashboard
1
+ Admin dashboard
@@ -1 +1 @@
1
- Home!
1
+ Home!
@@ -1 +1 @@
1
- Join
1
+ Join
@@ -1 +1 @@
1
- User dashboard
1
+ User dashboard
@@ -7,7 +7,7 @@
7
7
  <body>
8
8
  <div id="container">
9
9
  <%- flash.each do |name, msg| -%>
10
- <%= content_tag :div, msg, :id => "flash_#{name}" %>
10
+ <%= content_tag :div, msg, id: "flash_#{name}" %>
11
11
  <%- end -%>
12
12
 
13
13
  <% if user_signed_in? -%>
@@ -0,0 +1 @@
1
+ <%= button_to 'Update', update_form_user_path(current_user), method: 'put' %>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -2,7 +2,6 @@ require File.expand_path('../boot', __FILE__)
2
2
 
3
3
  require "action_controller/railtie"
4
4
  require "action_mailer/railtie"
5
- require "active_resource/railtie"
6
5
  require "rails/test_unit/railtie"
7
6
 
8
7
  Bundler.require :default, DEVISE_ORM
@@ -17,21 +16,21 @@ require "devise"
17
16
  module RailsApp
18
17
  class Application < Rails::Application
19
18
  # Add additional load paths for your own custom dirs
20
- config.autoload_paths.reject!{ |p| p =~ /\/app\/(\w+)$/ && !%w(controllers helpers views).include?($1) }
21
- config.autoload_paths += [ "#{config.root}/app/#{DEVISE_ORM}" ]
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}"]
22
21
 
23
22
  # Configure generators values. Many other options are available, be sure to check the documentation.
24
23
  # config.generators do |g|
25
24
  # g.orm :active_record
26
25
  # g.template_engine :erb
27
- # g.test_framework :test_unit, :fixture => true
26
+ # g.test_framework :test_unit, fixture: true
28
27
  # end
29
28
 
30
29
  # Configure sensitive parameters which will be filtered from the log file.
31
30
  config.filter_parameters << :password
32
31
  config.assets.enabled = false
33
32
 
34
- config.action_mailer.default_url_options = { :host => "localhost:3000" }
33
+ config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
35
34
 
36
35
  # This was used to break devise in some situations
37
36
  config.to_prepare do
@@ -2,7 +2,13 @@ unless defined?(DEVISE_ORM)
2
2
  DEVISE_ORM = (ENV["DEVISE_ORM"] || :active_record).to_sym
3
3
  end
4
4
 
5
- require 'rubygems'
6
- require 'bundler/setup'
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
7
11
 
8
- $:.unshift File.expand_path('../../../../lib', __FILE__)
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,5 +1,5 @@
1
- # Load the rails application
1
+ # Load the rails application.
2
2
  require File.expand_path('../application', __FILE__)
3
3
 
4
- # Initialize the rails application
4
+ # Initialize the rails application.
5
5
  RailsApp::Application.initialize!
@@ -1,18 +1,30 @@
1
1
  RailsApp::Application.configure do
2
- # Settings specified here will take precedence over those in config/environment.rb
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
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 webserver when you make code changes.
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
7
  config.cache_classes = false
8
8
 
9
- # Log error messages when you accidentally call methods on nil.
10
- config.whiny_nils = true
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
11
11
 
12
- # Show full error reports and disable caching
12
+ # Show full error reports and disable caching.
13
13
  config.consider_all_requests_local = true
14
14
  config.action_controller.perform_caching = false
15
15
 
16
- # Don't care if the mailer can't send
16
+ # Don't care if the mailer can't send.
17
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
18
30
  end
@@ -1,33 +1,84 @@
1
1
  RailsApp::Application.configure do
2
- # Settings specified here will take precedence over those in config/environment.rb
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
- # The production environment is meant for finished, "live" apps.
5
- # Code is not reloaded between requests
4
+ # Code is not reloaded between requests.
6
5
  config.cache_classes = true
7
6
 
8
- # Full error reports are disabled and caching is turned on
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.
9
14
  config.consider_all_requests_local = false
10
15
  config.action_controller.perform_caching = true
11
16
 
12
- # See everything in the log (default is :info)
13
- # config.log_level = :debug
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
14
21
 
15
- # Use a different logger for distributed setups
16
- # config.logger = SyslogLogger.new
22
+ # Disable Rails's static asset server (Apache or nginx will already do this).
23
+ if Rails.version >= "4.2.0"
24
+ config.serve_static_files = false
25
+ else
26
+ config.serve_static_assets = false
27
+ end
17
28
 
18
- # Use a different cache store in production
19
- # config.cache_store = :mem_cache_store
29
+ # Compress JavaScripts and CSS.
30
+ config.assets.js_compressor = :uglifier
31
+ # config.assets.css_compressor = :sass
32
+
33
+ # Whether to fallback to assets pipeline if a precompiled asset is missed.
34
+ config.assets.compile = false
35
+
36
+ # Generate digests for assets URLs.
37
+ config.assets.digest = true
38
+
39
+ # Version of your assets, change this if you want to expire all your assets.
40
+ config.assets.version = '1.0'
41
+
42
+ # Specifies the header that your server uses for sending files.
43
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
44
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
45
+
46
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
47
+ # config.force_ssl = true
48
+
49
+ # Set to :debug to see everything in the log.
50
+ config.log_level = :info
20
51
 
21
- # Disable Rails's static asset server
22
- # In production, Apache or nginx will already do this
23
- config.serve_static_assets = false
52
+ # Prepend all log lines with the following tags.
53
+ # config.log_tags = [:subdomain, :uuid]
24
54
 
25
- # Enable serving of images, stylesheets, and javascripts from an asset server
55
+ # Use a different logger for distributed setups.
56
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
57
+
58
+ # Use a different cache store in production.
59
+ # config.cache_store = :mem_cache_store
60
+
61
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
26
62
  # config.action_controller.asset_host = "http://assets.example.com"
27
63
 
28
- # Disable delivery errors, bad email addresses will be ignored
64
+ # Precompile additional assets.
65
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
66
+ # config.assets.precompile += %w( search.js )
67
+
68
+ # Ignore bad email addresses and do not raise email delivery errors.
69
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
29
70
  # config.action_mailer.raise_delivery_errors = false
30
71
 
31
- # Enable threaded mode
32
- # config.threadsafe!
72
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
73
+ # the I18n.default_locale when a translation can not be found).
74
+ config.i18n.fallbacks = true
75
+
76
+ # Send deprecation notices to registered listeners.
77
+ config.active_support.deprecation = :notify
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
33
84
  end
@@ -1,33 +1,41 @@
1
1
  RailsApp::Application.configure do
2
- # Settings specified here will take precedence over those in config/environment.rb
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
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
5
+ # test suite. You never need to work with it otherwise. Remember that
6
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!
7
+ # and recreated between test runs. Don't rely on the data there!
8
8
  config.cache_classes = true
9
9
 
10
- # Log error messages when you accidentally call methods on nil.
11
- config.whiny_nils = true
12
-
13
- # Show full error reports and disable caching
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
+ config.static_cache_control = "public, max-age=3600"
23
+
24
+ # Show full error reports and disable caching.
14
25
  config.consider_all_requests_local = true
15
26
  config.action_controller.perform_caching = false
16
27
 
17
- # Disable request forgery protection in test environment
18
- config.action_controller.allow_forgery_protection = false
28
+ # Raise exceptions instead of rendering exception templates.
29
+ config.action_dispatch.show_exceptions = false
30
+
31
+ # Disable request forgery protection in test environment.
32
+ config.action_controller.allow_forgery_protection = false
19
33
 
20
34
  # Tell Action Mailer not to deliver emails to the real world.
21
35
  # The :test delivery method accumulates sent emails in the
22
36
  # ActionMailer::Base.deliveries array.
23
37
  config.action_mailer.delivery_method = :test
24
38
 
25
- # Use SQL instead of Active Record's schema dumper when creating the test database.
26
- # This is necessary if your schema can't be completely dumped by the schema dumper,
27
- # like if you have constraints or database-specific column types
28
- # config.active_record.schema_format = :sql
29
-
30
- config.action_dispatch.show_exceptions = false
31
-
39
+ # Print deprecation notices to the stderr.
32
40
  config.active_support.deprecation = :stderr
33
41
  end
@@ -4,11 +4,16 @@ require "omniauth-openid"
4
4
  # Use this hook to configure devise mailer, warden hooks and so forth. The first
5
5
  # four configuration values can also be set straight in your models.
6
6
  Devise.setup do |config|
7
+ config.secret_key = "d9eb5171c59a4c817f68b0de27b8c1e340c2341b52cdbc60d3083d4e8958532" \
8
+ "18dcc5f589cafde048faec956b61f864b9b5513ff9ce29bf9e5d58b0f234f8e3b"
9
+
7
10
  # ==> Mailer Configuration
8
11
  # Configure the e-mail address which will be shown in Devise::Mailer,
9
12
  # note that it will be overwritten if you use your own mailer class with default "from" parameter.
10
13
  config.mailer_sender = "please-change-me@config-initializers-devise.com"
11
14
 
15
+
16
+ config.parent_controller = "ApplicationWithFakeEngine"
12
17
  # Configure the class responsible to send e-mails.
13
18
  # config.mailer = "Devise::Mailer"
14
19
 
@@ -26,7 +31,7 @@ Devise.setup do |config|
26
31
  # session. If you need permissions, you should implement that in a before filter.
27
32
  # You can also supply hash where the value is a boolean expliciting if authentication
28
33
  # should be aborted or not if the value is not present. By default is empty.
29
- # config.authentication_keys = [ :email ]
34
+ # config.authentication_keys = [:email]
30
35
 
31
36
  # Configure parameters from the request object used for authentication. Each entry
32
37
  # given should be a request method and it will automatically be passed to
@@ -38,12 +43,12 @@ Devise.setup do |config|
38
43
  # Configure which authentication keys should be case-insensitive.
39
44
  # These keys will be downcased upon creating or modifying a user and when used
40
45
  # to authenticate or find a user. Default is :email.
41
- config.case_insensitive_keys = [ :email ]
46
+ config.case_insensitive_keys = [:email]
42
47
 
43
48
  # Configure which authentication keys should have whitespace stripped.
44
49
  # These keys will have whitespace before and after removed upon creating or
45
50
  # modifying a user and when used to authenticate or find a user. Default is :email.
46
- config.strip_whitespace_keys = [ :email ]
51
+ config.strip_whitespace_keys = [:email]
47
52
 
48
53
  # Tell if authentication through request.params is enabled. True by default.
49
54
  # config.params_authenticatable = true
@@ -63,8 +68,8 @@ Devise.setup do |config|
63
68
  config.stretches = Rails.env.test? ? 1 : 10
64
69
 
65
70
  # ==> Configuration for :confirmable
66
- # The time you want to give your user to confirm his account. During this time
67
- # he will be able to access your application without confirming. Default is nil.
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.
68
73
  # When allow_unconfirmed_access_for is zero, the user won't be able to sign in without confirming.
69
74
  # You can use this to let your user access some features of your application
70
75
  # without confirming the account, but blocking it after a certain period
@@ -72,21 +77,18 @@ Devise.setup do |config|
72
77
  # config.allow_unconfirmed_access_for = 2.days
73
78
 
74
79
  # Defines which key will be used when confirming an account
75
- # config.confirmation_keys = [ :email ]
80
+ # config.confirmation_keys = [:email]
76
81
 
77
82
  # ==> Configuration for :rememberable
78
83
  # The time the user will be remembered without asking for credentials again.
79
84
  # config.remember_for = 2.weeks
80
85
 
81
- # If true, a valid remember token can be re-used between multiple browsers.
82
- # config.remember_across_browsers = true
83
-
84
86
  # If true, extends the user's remember period when remembered via cookie.
85
87
  # config.extend_remember_period = false
86
88
 
87
89
  # ==> Configuration for :validatable
88
- # Range for password length. Default is 6..128.
89
- # config.password_length = 6..128
90
+ # Range for password length. Default is 8..72.
91
+ # config.password_length = 8..72
90
92
 
91
93
  # Regex to use to validate the email address
92
94
  # config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
@@ -103,7 +105,7 @@ Devise.setup do |config|
103
105
  # config.lock_strategy = :failed_attempts
104
106
 
105
107
  # Defines which key will be used when locking and unlocking an account
106
- # config.unlock_keys = [ :email ]
108
+ # config.unlock_keys = [:email]
107
109
 
108
110
  # Defines which strategy will be used to unlock an account.
109
111
  # :email = Sends an unlock link to the user email
@@ -122,20 +124,20 @@ Devise.setup do |config|
122
124
  # ==> Configuration for :recoverable
123
125
  #
124
126
  # Defines which key will be used when recovering the password for an account
125
- # config.reset_password_keys = [ :email ]
127
+ # config.reset_password_keys = [:email]
126
128
 
127
129
  # Time interval you can reset your password with a reset password key.
128
130
  # Don't put a too small interval or your users won't have the time to
129
131
  # change their passwords.
130
132
  config.reset_password_within = 2.hours
131
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
+
132
138
  # Setup a pepper to generate the encrypted password.
133
139
  config.pepper = "d142367154e5beacca404b1a6a4f8bc52c6fdcfa3ccc3cf8eb49f3458a688ee6ac3b9fae488432a3bfca863b8a90008368a9f3a3dfbe5a962e64b6ab8f3a3a1a"
134
140
 
135
- # ==> Configuration for :token_authenticatable
136
- # Defines name of the authentication token params key
137
- # config.token_authentication_key = :auth_token
138
-
139
141
  # ==> Scopes configuration
140
142
  # Turn scoped views on. Before rendering "sessions/new", it will first check for
141
143
  # "users/sessions/new". It's turned off by default because it's slower if you
@@ -163,9 +165,9 @@ Devise.setup do |config|
163
165
  # config.sign_out_via = :get
164
166
 
165
167
  # ==> OmniAuth
166
- config.omniauth :facebook, 'APP_ID', 'APP_SECRET', :scope => 'email,offline_access'
168
+ config.omniauth :facebook, 'APP_ID', 'APP_SECRET', scope: 'email,offline_access'
167
169
  config.omniauth :openid
168
- config.omniauth :openid, :name => 'google', :identifier => 'https://www.google.com/accounts/o8/id'
170
+ config.omniauth :openid, name: 'google', identifier: 'https://www.google.com/accounts/o8/id'
169
171
 
170
172
  # ==> Warden configuration
171
173
  # If you want to use other strategies, that are not supported by Devise, or
@@ -173,6 +175,6 @@ Devise.setup do |config|
173
175
  #
174
176
  # config.warden do |manager|
175
177
  # manager.failure_app = AnotherApp
176
- # manager.default_strategies(:scope => :user).unshift :some_external_strategy
178
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
177
179
  # end
178
180
  end
@@ -1,2 +1,8 @@
1
- Rails.application.config.secret_token = 'ea942c41850d502f2c8283e26bdc57829f471bb18224ddff0a192c4f32cdf6cb5aa0d82b3a7a7adbeb640c4b06f3aa1cd5f098162d8240f669b39d6b49680571'
2
- Rails.application.config.session_store :cookie_store, :key => "_my_app"
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