devbootsrap 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (219) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/Gemfile +31 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +29 -0
  6. data/Rakefile +1 -0
  7. data/app/controllers/devise/confirmations_controller.rb +47 -0
  8. data/app/controllers/devise/omniauth_callbacks_controller.rb +30 -0
  9. data/app/controllers/devise/passwords_controller.rb +70 -0
  10. data/app/controllers/devise/registrations_controller.rb +137 -0
  11. data/app/controllers/devise/sessions_controller.rb +53 -0
  12. data/app/controllers/devise/unlocks_controller.rb +46 -0
  13. data/app/controllers/devise_controller.rb +176 -0
  14. data/app/helpers/devise_helper.rb +25 -0
  15. data/app/mailers/devise/mailer.rb +20 -0
  16. data/app/views/devise/confirmations/new.html.erb +12 -0
  17. data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  18. data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  19. data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  20. data/app/views/devise/passwords/edit.html.erb +16 -0
  21. data/app/views/devise/passwords/new.html.erb +12 -0
  22. data/app/views/devise/registrations/edit.html.erb +29 -0
  23. data/app/views/devise/registrations/new.html.erb +18 -0
  24. data/app/views/devise/sessions/new.html.erb +17 -0
  25. data/app/views/devise/shared/_links.erb +25 -0
  26. data/app/views/devise/unlocks/new.html.erb +12 -0
  27. data/config/locales/en.yml +59 -0
  28. data/devbootsrap.gemspec +29 -0
  29. data/gemfiles/Gemfile.rails-3.2-stable +29 -0
  30. data/gemfiles/Gemfile.rails-4.0-stable +29 -0
  31. data/gemfiles/Gemfile.rails-head +29 -0
  32. data/lib/devbootsrap.rb +5 -0
  33. data/lib/devbootsrap/version.rb +3 -0
  34. data/lib/devise.rb +491 -0
  35. data/lib/devise/controllers/helpers.rb +213 -0
  36. data/lib/devise/controllers/rememberable.rb +47 -0
  37. data/lib/devise/controllers/scoped_views.rb +17 -0
  38. data/lib/devise/controllers/sign_in_out.rb +103 -0
  39. data/lib/devise/controllers/store_location.rb +50 -0
  40. data/lib/devise/controllers/url_helpers.rb +67 -0
  41. data/lib/devise/delegator.rb +16 -0
  42. data/lib/devise/failure_app.rb +205 -0
  43. data/lib/devise/hooks/activatable.rb +11 -0
  44. data/lib/devise/hooks/csrf_cleaner.rb +5 -0
  45. data/lib/devise/hooks/forgetable.rb +9 -0
  46. data/lib/devise/hooks/lockable.rb +7 -0
  47. data/lib/devise/hooks/proxy.rb +21 -0
  48. data/lib/devise/hooks/rememberable.rb +7 -0
  49. data/lib/devise/hooks/timeoutable.rb +28 -0
  50. data/lib/devise/hooks/trackable.rb +9 -0
  51. data/lib/devise/mailers/helpers.rb +90 -0
  52. data/lib/devise/mapping.rb +172 -0
  53. data/lib/devise/models.rb +119 -0
  54. data/lib/devise/models/authenticatable.rb +284 -0
  55. data/lib/devise/models/confirmable.rb +295 -0
  56. data/lib/devise/models/database_authenticatable.rb +164 -0
  57. data/lib/devise/models/lockable.rb +196 -0
  58. data/lib/devise/models/omniauthable.rb +27 -0
  59. data/lib/devise/models/recoverable.rb +131 -0
  60. data/lib/devise/models/registerable.rb +25 -0
  61. data/lib/devise/models/rememberable.rb +129 -0
  62. data/lib/devise/models/timeoutable.rb +49 -0
  63. data/lib/devise/models/trackable.rb +35 -0
  64. data/lib/devise/models/validatable.rb +66 -0
  65. data/lib/devise/modules.rb +28 -0
  66. data/lib/devise/omniauth.rb +28 -0
  67. data/lib/devise/omniauth/config.rb +45 -0
  68. data/lib/devise/omniauth/url_helpers.rb +18 -0
  69. data/lib/devise/orm/active_record.rb +3 -0
  70. data/lib/devise/orm/mongoid.rb +3 -0
  71. data/lib/devise/parameter_filter.rb +40 -0
  72. data/lib/devise/parameter_sanitizer.rb +99 -0
  73. data/lib/devise/rails.rb +56 -0
  74. data/lib/devise/rails/routes.rb +496 -0
  75. data/lib/devise/rails/warden_compat.rb +22 -0
  76. data/lib/devise/strategies/authenticatable.rb +167 -0
  77. data/lib/devise/strategies/base.rb +20 -0
  78. data/lib/devise/strategies/database_authenticatable.rb +23 -0
  79. data/lib/devise/strategies/rememberable.rb +55 -0
  80. data/lib/devise/test_helpers.rb +132 -0
  81. data/lib/devise/time_inflector.rb +14 -0
  82. data/lib/devise/token_generator.rb +70 -0
  83. data/lib/devise/version.rb +3 -0
  84. data/lib/generators/active_record/devise_generator.rb +73 -0
  85. data/lib/generators/active_record/templates/migration.rb +18 -0
  86. data/lib/generators/active_record/templates/migration_existing.rb +25 -0
  87. data/lib/generators/devise/devise_generator.rb +26 -0
  88. data/lib/generators/devise/install_generator.rb +29 -0
  89. data/lib/generators/devise/orm_helpers.rb +51 -0
  90. data/lib/generators/devise/views_generator.rb +135 -0
  91. data/lib/generators/mongoid/devise_generator.rb +55 -0
  92. data/lib/generators/templates/README +35 -0
  93. data/lib/generators/templates/devise.rb +260 -0
  94. data/lib/generators/templates/markerb/confirmation_instructions.markerb +5 -0
  95. data/lib/generators/templates/markerb/reset_password_instructions.markerb +8 -0
  96. data/lib/generators/templates/markerb/unlock_instructions.markerb +7 -0
  97. data/lib/generators/templates/simple_form_for/confirmations/new.html.erb +16 -0
  98. data/lib/generators/templates/simple_form_for/passwords/edit.html.erb +19 -0
  99. data/lib/generators/templates/simple_form_for/passwords/new.html.erb +15 -0
  100. data/lib/generators/templates/simple_form_for/registrations/edit.html.erb +27 -0
  101. data/lib/generators/templates/simple_form_for/registrations/new.html.erb +17 -0
  102. data/lib/generators/templates/simple_form_for/sessions/new.html.erb +15 -0
  103. data/lib/generators/templates/simple_form_for/unlocks/new.html.erb +16 -0
  104. data/test/controllers/custom_registrations_controller_test.rb +35 -0
  105. data/test/controllers/custom_strategy_test.rb +62 -0
  106. data/test/controllers/helpers_test.rb +276 -0
  107. data/test/controllers/internal_helpers_test.rb +123 -0
  108. data/test/controllers/passwords_controller_test.rb +31 -0
  109. data/test/controllers/sessions_controller_test.rb +103 -0
  110. data/test/controllers/url_helpers_test.rb +59 -0
  111. data/test/delegator_test.rb +19 -0
  112. data/test/devise_test.rb +94 -0
  113. data/test/failure_app_test.rb +232 -0
  114. data/test/generators/active_record_generator_test.rb +103 -0
  115. data/test/generators/devise_generator_test.rb +39 -0
  116. data/test/generators/install_generator_test.rb +13 -0
  117. data/test/generators/mongoid_generator_test.rb +23 -0
  118. data/test/generators/views_generator_test.rb +96 -0
  119. data/test/helpers/devise_helper_test.rb +51 -0
  120. data/test/integration/authenticatable_test.rb +713 -0
  121. data/test/integration/confirmable_test.rb +284 -0
  122. data/test/integration/database_authenticatable_test.rb +84 -0
  123. data/test/integration/http_authenticatable_test.rb +105 -0
  124. data/test/integration/lockable_test.rb +239 -0
  125. data/test/integration/omniauthable_test.rb +133 -0
  126. data/test/integration/recoverable_test.rb +334 -0
  127. data/test/integration/registerable_test.rb +349 -0
  128. data/test/integration/rememberable_test.rb +167 -0
  129. data/test/integration/timeoutable_test.rb +183 -0
  130. data/test/integration/trackable_test.rb +92 -0
  131. data/test/mailers/confirmation_instructions_test.rb +115 -0
  132. data/test/mailers/reset_password_instructions_test.rb +96 -0
  133. data/test/mailers/unlock_instructions_test.rb +91 -0
  134. data/test/mapping_test.rb +127 -0
  135. data/test/models/authenticatable_test.rb +13 -0
  136. data/test/models/confirmable_test.rb +454 -0
  137. data/test/models/database_authenticatable_test.rb +249 -0
  138. data/test/models/lockable_test.rb +316 -0
  139. data/test/models/omniauthable_test.rb +7 -0
  140. data/test/models/recoverable_test.rb +184 -0
  141. data/test/models/registerable_test.rb +7 -0
  142. data/test/models/rememberable_test.rb +183 -0
  143. data/test/models/serializable_test.rb +49 -0
  144. data/test/models/timeoutable_test.rb +51 -0
  145. data/test/models/trackable_test.rb +13 -0
  146. data/test/models/validatable_test.rb +127 -0
  147. data/test/models_test.rb +144 -0
  148. data/test/omniauth/config_test.rb +57 -0
  149. data/test/omniauth/url_helpers_test.rb +54 -0
  150. data/test/orm/active_record.rb +10 -0
  151. data/test/orm/mongoid.rb +13 -0
  152. data/test/parameter_sanitizer_test.rb +81 -0
  153. data/test/rails_app/Rakefile +6 -0
  154. data/test/rails_app/app/active_record/admin.rb +6 -0
  155. data/test/rails_app/app/active_record/shim.rb +2 -0
  156. data/test/rails_app/app/active_record/user.rb +6 -0
  157. data/test/rails_app/app/controllers/admins/sessions_controller.rb +6 -0
  158. data/test/rails_app/app/controllers/admins_controller.rb +11 -0
  159. data/test/rails_app/app/controllers/application_controller.rb +9 -0
  160. data/test/rails_app/app/controllers/custom/registrations_controller.rb +21 -0
  161. data/test/rails_app/app/controllers/home_controller.rb +25 -0
  162. data/test/rails_app/app/controllers/publisher/registrations_controller.rb +2 -0
  163. data/test/rails_app/app/controllers/publisher/sessions_controller.rb +2 -0
  164. data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +14 -0
  165. data/test/rails_app/app/controllers/users_controller.rb +31 -0
  166. data/test/rails_app/app/helpers/application_helper.rb +3 -0
  167. data/test/rails_app/app/mailers/users/mailer.rb +12 -0
  168. data/test/rails_app/app/mongoid/admin.rb +29 -0
  169. data/test/rails_app/app/mongoid/shim.rb +23 -0
  170. data/test/rails_app/app/mongoid/user.rb +39 -0
  171. data/test/rails_app/app/views/admins/index.html.erb +1 -0
  172. data/test/rails_app/app/views/admins/sessions/new.html.erb +2 -0
  173. data/test/rails_app/app/views/home/admin_dashboard.html.erb +1 -0
  174. data/test/rails_app/app/views/home/index.html.erb +1 -0
  175. data/test/rails_app/app/views/home/join.html.erb +1 -0
  176. data/test/rails_app/app/views/home/private.html.erb +1 -0
  177. data/test/rails_app/app/views/home/user_dashboard.html.erb +1 -0
  178. data/test/rails_app/app/views/layouts/application.html.erb +24 -0
  179. data/test/rails_app/app/views/users/edit_form.html.erb +1 -0
  180. data/test/rails_app/app/views/users/index.html.erb +1 -0
  181. data/test/rails_app/app/views/users/mailer/confirmation_instructions.erb +1 -0
  182. data/test/rails_app/app/views/users/sessions/new.html.erb +1 -0
  183. data/test/rails_app/bin/bundle +3 -0
  184. data/test/rails_app/bin/rails +4 -0
  185. data/test/rails_app/bin/rake +4 -0
  186. data/test/rails_app/config.ru +4 -0
  187. data/test/rails_app/config/application.rb +40 -0
  188. data/test/rails_app/config/boot.rb +14 -0
  189. data/test/rails_app/config/database.yml +18 -0
  190. data/test/rails_app/config/environment.rb +5 -0
  191. data/test/rails_app/config/environments/development.rb +30 -0
  192. data/test/rails_app/config/environments/production.rb +80 -0
  193. data/test/rails_app/config/environments/test.rb +36 -0
  194. data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  195. data/test/rails_app/config/initializers/devise.rb +181 -0
  196. data/test/rails_app/config/initializers/inflections.rb +2 -0
  197. data/test/rails_app/config/initializers/secret_token.rb +8 -0
  198. data/test/rails_app/config/initializers/session_store.rb +1 -0
  199. data/test/rails_app/config/routes.rb +108 -0
  200. data/test/rails_app/db/migrate/20100401102949_create_tables.rb +71 -0
  201. data/test/rails_app/db/schema.rb +55 -0
  202. data/test/rails_app/lib/shared_admin.rb +17 -0
  203. data/test/rails_app/lib/shared_user.rb +29 -0
  204. data/test/rails_app/public/404.html +26 -0
  205. data/test/rails_app/public/422.html +26 -0
  206. data/test/rails_app/public/500.html +26 -0
  207. data/test/rails_app/public/favicon.ico +0 -0
  208. data/test/routes_test.rb +262 -0
  209. data/test/support/action_controller/record_identifier.rb +10 -0
  210. data/test/support/assertions.rb +40 -0
  211. data/test/support/helpers.rb +70 -0
  212. data/test/support/integration.rb +92 -0
  213. data/test/support/locale/en.yml +8 -0
  214. data/test/support/mongoid.yml +6 -0
  215. data/test/support/webrat/integrations/rails.rb +24 -0
  216. data/test/test_helper.rb +27 -0
  217. data/test/test_helpers_test.rb +173 -0
  218. data/test/test_models.rb +33 -0
  219. metadata +480 -0
@@ -0,0 +1,5 @@
1
+ # Load the rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application.
5
+ RailsApp::Application.initialize!
@@ -0,0 +1,30 @@
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
@@ -0,0 +1,80 @@
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
@@ -0,0 +1,36 @@
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
@@ -0,0 +1,7 @@
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!
@@ -0,0 +1,181 @@
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
@@ -0,0 +1,2 @@
1
+ ActiveSupport::Inflector.inflections do |inflect|
2
+ end
@@ -0,0 +1,8 @@
1
+ config = Rails.application.config
2
+
3
+ if Devise.rails4?
4
+ config.secret_key_base = 'd588e99efff13a86461fd6ab82327823ad2f8feb5dc217ce652cdd9f0dfc5eb4b5a62a92d24d2574d7d51dfb1ea8dd453ea54e00cf672159a13104a135422a10'
5
+ else
6
+ config.secret_token = 'ea942c41850d502f2c8283e26bdc57829f471bb18224ddff0a192c4f32cdf6cb5aa0d82b3a7a7adbeb640c4b06f3aa1cd5f098162d8240f669b39d6b49680571'
7
+ config.session_store :cookie_store, key: "_my_app"
8
+ end
@@ -0,0 +1 @@
1
+ RailsApp::Application.config.session_store :cookie_store, key: '_rails_app_session'
@@ -0,0 +1,108 @@
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
+ # Routes for custom controller testing
30
+ devise_for :user, only: [:registrations], controllers: { registrations: "custom/registrations" }, as: :custom, path: :custom
31
+
32
+ # Admin scope
33
+ devise_for :admin, path: "admin_area", controllers: { sessions: :"admins/sessions" }, skip: :passwords
34
+
35
+ get "/admin_area/home", to: "admins#index", as: :admin_root
36
+ get "/anywhere", to: "foo#bar", as: :new_admin_password
37
+
38
+ authenticate(:admin) do
39
+ get "/private", to: "home#private", as: :private
40
+ end
41
+
42
+ authenticate(:admin, lambda { |admin| admin.active? }) do
43
+ get "/private/active", to: "home#private", as: :private_active
44
+ end
45
+
46
+ authenticated :admin do
47
+ get "/dashboard", to: "home#admin_dashboard"
48
+ end
49
+
50
+ authenticated :admin, lambda { |admin| admin.active? } do
51
+ get "/dashboard/active", to: "home#admin_dashboard"
52
+ end
53
+
54
+ authenticated do
55
+ get "/dashboard", to: "home#user_dashboard"
56
+ end
57
+
58
+ unauthenticated do
59
+ get "/join", to: "home#join"
60
+ end
61
+
62
+ # Routes for constraints testing
63
+ devise_for :headquarters_admin, class_name: "Admin", path: "headquarters", constraints: {host: /192\.168\.1\.\d\d\d/}
64
+
65
+ constraints(host: /192\.168\.1\.\d\d\d/) do
66
+ devise_for :homebase_admin, class_name: "Admin", path: "homebase"
67
+ end
68
+
69
+ devise_for :skip_admin, class_name: "Admin", skip: :all
70
+
71
+ # Routes for format=false testing
72
+ devise_for :htmlonly_admin, class_name: "Admin", skip: [:confirmations, :unlocks], path: "htmlonly_admin", format: false, skip_helpers: [:confirmations, :unlocks]
73
+ devise_for :htmlonly_users, class_name: "User", only: [:confirmations, :unlocks], path: "htmlonly_users", format: false, skip_helpers: true
74
+
75
+ # Other routes for routing_test.rb
76
+ devise_for :reader, class_name: "User", only: :passwords
77
+
78
+ scope host: "sub.example.com" do
79
+ devise_for :sub_admin, class_name: "Admin"
80
+ end
81
+
82
+ namespace :publisher, path_names: { sign_in: "i_dont_care", sign_out: "get_out" } do
83
+ devise_for :accounts, class_name: "Admin", path_names: { sign_in: "get_in" }
84
+ end
85
+
86
+ scope ":locale", module: :invalid do
87
+ devise_for :accounts, singular: "manager", class_name: "Admin",
88
+ path_names: {
89
+ sign_in: "login", sign_out: "logout",
90
+ password: "secret", confirmation: "verification",
91
+ unlock: "unblock", sign_up: "register",
92
+ registration: "management",
93
+ cancel: "giveup", edit: "edit/profile"
94
+ }, failure_app: lambda { |env| [404, {"Content-Type" => "text/plain"}, ["Oops, not found"]] }, module: :devise
95
+ end
96
+
97
+ namespace :sign_out_via, module: "devise" do
98
+ devise_for :deletes, sign_out_via: :delete, class_name: "Admin"
99
+ devise_for :posts, sign_out_via: :post, class_name: "Admin"
100
+ devise_for :delete_or_posts, sign_out_via: [:delete, :post], class_name: "Admin"
101
+ end
102
+
103
+ get "/set", to: "home#set"
104
+ get "/unauthenticated", to: "home#unauthenticated"
105
+ get "/custom_strategy/new"
106
+
107
+ root to: "home#index", via: [:get, :post]
108
+ end