mongo_session_store 3.2.0 → 3.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +100 -0
  3. data/.github/workflows/danger-comment.yml +11 -0
  4. data/.github/workflows/danger.yml +45 -0
  5. data/.rubocop.yml +4 -4
  6. data/CHANGELOG.md +9 -2
  7. data/Dangerfile +5 -1
  8. data/Gemfile +2 -0
  9. data/Gemfile.danger +5 -0
  10. data/README.md +30 -7
  11. data/RELEASING.md +37 -0
  12. data/Rakefile +4 -4
  13. data/docker-compose.yml +5 -0
  14. data/gemfiles/rails-5.1-mongoid.gemfile +1 -1
  15. data/gemfiles/rails-6.0-mongo.gemfile +12 -0
  16. data/gemfiles/rails-6.0-mongoid.gemfile +12 -0
  17. data/gemfiles/rails-8.1-mongo.gemfile +14 -0
  18. data/gemfiles/rails-8.1-mongoid.gemfile +14 -0
  19. data/lib/mongo_session_store/mongo_store_base.rb +2 -1
  20. data/lib/mongo_session_store/mongoid_store.rb +1 -0
  21. data/lib/mongo_session_store/version.rb +1 -1
  22. data/mongo_session_store.gemspec +4 -7
  23. data/script/test +20 -0
  24. data/script/test_inner +19 -0
  25. data/script/testenv +6 -0
  26. data/spec/integrations/devise_spec.rb +2 -2
  27. data/spec/integrations/rack_spec.rb +19 -0
  28. data/spec/rails_helper.rb +3 -0
  29. data/spec/spec_helper.rb +4 -2
  30. data/spec/support/apps/rails_5.0_app/config/routes.rb +1 -0
  31. data/spec/support/apps/rails_5.1_app/config/routes.rb +1 -0
  32. data/spec/support/apps/rails_5.2_app/config/routes.rb +1 -0
  33. data/spec/support/apps/{rails_4.0_app → rails_6.0_app}/Rakefile +2 -2
  34. data/spec/support/apps/rails_6.0_app/app/controllers/application_controller.rb +3 -0
  35. data/spec/support/apps/rails_6.0_app/app/models/application_record.rb +3 -0
  36. data/spec/support/apps/{rails_4.2_app → rails_6.0_app}/app/models/user.rb +2 -2
  37. data/spec/support/apps/{rails_4.2_app → rails_6.0_app}/app/views/layouts/application.html.erb +1 -1
  38. data/spec/support/apps/rails_6.0_app/bin/rails +4 -0
  39. data/spec/support/apps/rails_6.0_app/bin/setup +33 -0
  40. data/spec/support/apps/rails_6.0_app/config/application.rb +17 -0
  41. data/spec/support/apps/rails_6.0_app/config/boot.rb +3 -0
  42. data/spec/support/apps/rails_6.0_app/config/credentials.yml.enc +1 -0
  43. data/spec/support/apps/rails_6.0_app/config/database.yml +31 -0
  44. data/spec/support/apps/{rails_4.2_app → rails_6.0_app}/config/environment.rb +1 -1
  45. data/spec/support/apps/rails_6.0_app/config/environments/development.rb +47 -0
  46. data/spec/support/apps/rails_6.0_app/config/environments/test.rb +38 -0
  47. data/spec/support/apps/rails_6.0_app/config/initializers/cookies_serializer.rb +5 -0
  48. data/spec/support/apps/{rails_4.0_app → rails_6.0_app}/config/initializers/devise.rb +79 -34
  49. data/spec/support/apps/rails_6.0_app/config/initializers/filter_parameter_logging.rb +4 -0
  50. data/spec/support/apps/rails_6.0_app/config/initializers/wrap_parameters.rb +14 -0
  51. data/spec/support/apps/{rails_4.0_app → rails_6.0_app}/config/locales/devise.en.yml +22 -16
  52. data/spec/support/apps/{rails_4.1_app → rails_6.0_app}/config/locales/en.yml +11 -1
  53. data/spec/support/apps/rails_6.0_app/config/master.key +1 -0
  54. data/spec/support/apps/{rails_4.2_app → rails_6.0_app}/config/routes.rb +1 -0
  55. data/spec/support/apps/{rails_4.2_app → rails_6.0_app}/config.ru +2 -1
  56. data/spec/support/apps/{rails_4.2_app/db/migrate/20140301171212_add_devise_users.rb → rails_6.0_app/db/migrate/20200427115501_add_devise_users.rb} +1 -1
  57. data/spec/support/apps/rails_6.0_app/db/schema.rb +23 -0
  58. data/spec/support/apps/rails_6.0_app/db/seeds.rb +7 -0
  59. data/spec/support/rack_app.rb +16 -0
  60. metadata +107 -235
  61. data/.travis.yml +0 -95
  62. data/gemfiles/rails-4.0-mongo.gemfile +0 -9
  63. data/gemfiles/rails-4.0-mongoid.gemfile +0 -9
  64. data/gemfiles/rails-4.1-mongo.gemfile +0 -9
  65. data/gemfiles/rails-4.1-mongoid.gemfile +0 -9
  66. data/gemfiles/rails-4.2-mongo.gemfile +0 -9
  67. data/gemfiles/rails-4.2-mongoid.gemfile +0 -9
  68. data/spec/support/apps/rails_4.0_app/app/controllers/application_controller.rb +0 -5
  69. data/spec/support/apps/rails_4.0_app/app/models/user.rb +0 -5
  70. data/spec/support/apps/rails_4.0_app/app/views/layouts/application.html.erb +0 -17
  71. data/spec/support/apps/rails_4.0_app/bin/bundle +0 -3
  72. data/spec/support/apps/rails_4.0_app/bin/rails +0 -4
  73. data/spec/support/apps/rails_4.0_app/bin/rake +0 -4
  74. data/spec/support/apps/rails_4.0_app/config/application.rb +0 -11
  75. data/spec/support/apps/rails_4.0_app/config/boot.rb +0 -4
  76. data/spec/support/apps/rails_4.0_app/config/database.yml +0 -11
  77. data/spec/support/apps/rails_4.0_app/config/environment.rb +0 -5
  78. data/spec/support/apps/rails_4.0_app/config/environments/development.rb +0 -12
  79. data/spec/support/apps/rails_4.0_app/config/environments/test.rb +0 -19
  80. data/spec/support/apps/rails_4.0_app/config/initializers/secret_token.rb +0 -12
  81. data/spec/support/apps/rails_4.0_app/config/initializers/session_store.rb +0 -1
  82. data/spec/support/apps/rails_4.0_app/config/locales/en.yml +0 -23
  83. data/spec/support/apps/rails_4.0_app/config/mongo.yml +0 -11
  84. data/spec/support/apps/rails_4.0_app/config/mongoid.yml +0 -13
  85. data/spec/support/apps/rails_4.0_app/config/routes.rb +0 -4
  86. data/spec/support/apps/rails_4.0_app/config.ru +0 -4
  87. data/spec/support/apps/rails_4.0_app/db/migrate/20140301171212_add_devise_users.rb +0 -11
  88. data/spec/support/apps/rails_4.0_app/db/schema.rb +0 -25
  89. data/spec/support/apps/rails_4.1_app/Rakefile +0 -3
  90. data/spec/support/apps/rails_4.1_app/app/controllers/application_controller.rb +0 -5
  91. data/spec/support/apps/rails_4.1_app/app/controllers/home_controller.rb +0 -2
  92. data/spec/support/apps/rails_4.1_app/app/models/user.rb +0 -5
  93. data/spec/support/apps/rails_4.1_app/app/views/home/index.html.erb +0 -9
  94. data/spec/support/apps/rails_4.1_app/app/views/layouts/application.html.erb +0 -17
  95. data/spec/support/apps/rails_4.1_app/bin/bundle +0 -3
  96. data/spec/support/apps/rails_4.1_app/bin/rails +0 -4
  97. data/spec/support/apps/rails_4.1_app/bin/rake +0 -4
  98. data/spec/support/apps/rails_4.1_app/config/application.rb +0 -11
  99. data/spec/support/apps/rails_4.1_app/config/boot.rb +0 -4
  100. data/spec/support/apps/rails_4.1_app/config/database.yml +0 -11
  101. data/spec/support/apps/rails_4.1_app/config/environment.rb +0 -5
  102. data/spec/support/apps/rails_4.1_app/config/environments/development.rb +0 -12
  103. data/spec/support/apps/rails_4.1_app/config/environments/test.rb +0 -19
  104. data/spec/support/apps/rails_4.1_app/config/initializers/devise.rb +0 -254
  105. data/spec/support/apps/rails_4.1_app/config/locales/devise.en.yml +0 -59
  106. data/spec/support/apps/rails_4.1_app/config/mongo.yml +0 -11
  107. data/spec/support/apps/rails_4.1_app/config/mongoid.yml +0 -13
  108. data/spec/support/apps/rails_4.1_app/config/routes.rb +0 -4
  109. data/spec/support/apps/rails_4.1_app/config/secrets.yml +0 -22
  110. data/spec/support/apps/rails_4.1_app/config.ru +0 -2
  111. data/spec/support/apps/rails_4.1_app/db/migrate/20140301171212_add_devise_users.rb +0 -11
  112. data/spec/support/apps/rails_4.1_app/db/schema.rb +0 -25
  113. data/spec/support/apps/rails_4.1_app/lib/assets/.keep +0 -0
  114. data/spec/support/apps/rails_4.1_app/lib/tasks/.keep +0 -0
  115. data/spec/support/apps/rails_4.1_app/log/.keep +0 -0
  116. data/spec/support/apps/rails_4.2_app/Rakefile +0 -2
  117. data/spec/support/apps/rails_4.2_app/app/controllers/application_controller.rb +0 -5
  118. data/spec/support/apps/rails_4.2_app/app/controllers/home_controller.rb +0 -2
  119. data/spec/support/apps/rails_4.2_app/app/views/home/index.html.erb +0 -9
  120. data/spec/support/apps/rails_4.2_app/bin/bundle +0 -3
  121. data/spec/support/apps/rails_4.2_app/bin/rails +0 -8
  122. data/spec/support/apps/rails_4.2_app/config/application.rb +0 -11
  123. data/spec/support/apps/rails_4.2_app/config/boot.rb +0 -3
  124. data/spec/support/apps/rails_4.2_app/config/database.yml +0 -11
  125. data/spec/support/apps/rails_4.2_app/config/environments/development.rb +0 -12
  126. data/spec/support/apps/rails_4.2_app/config/environments/test.rb +0 -19
  127. data/spec/support/apps/rails_4.2_app/config/initializers/devise.rb +0 -254
  128. data/spec/support/apps/rails_4.2_app/config/initializers/session_store.rb +0 -1
  129. data/spec/support/apps/rails_4.2_app/config/locales/en.yml +0 -23
  130. data/spec/support/apps/rails_4.2_app/config/secrets.yml +0 -22
  131. data/spec/support/apps/rails_4.2_app/db/schema.rb +0 -25
  132. /data/spec/support/apps/{rails_4.0_app → rails_6.0_app}/app/controllers/home_controller.rb +0 -0
  133. /data/spec/support/apps/{rails_4.0_app → rails_6.0_app}/app/views/home/index.html.erb +0 -0
  134. /data/spec/support/apps/{rails_4.2_app → rails_6.0_app}/bin/rake +0 -0
  135. /data/spec/support/apps/{rails_4.1_app → rails_6.0_app}/config/initializers/session_store.rb +0 -0
  136. /data/spec/support/apps/{rails_4.2_app → rails_6.0_app}/config/mongo.yml +0 -0
  137. /data/spec/support/apps/{rails_4.2_app → rails_6.0_app}/config/mongoid.yml +0 -0
  138. /data/spec/support/apps/{rails_4.0_app → rails_6.0_app}/lib/assets/.keep +0 -0
  139. /data/spec/support/apps/{rails_4.0_app → rails_6.0_app}/lib/tasks/.keep +0 -0
  140. /data/spec/support/apps/{rails_4.0_app → rails_6.0_app}/log/.keep +0 -0
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
@@ -1,5 +1,5 @@
1
- class User < ActiveRecord::Base
1
+ class User < ApplicationRecord
2
2
  # Include default devise modules. Others available are:
3
3
  # :confirmable, :lockable, :timeoutable and :omniauthable
4
4
  devise :database_authenticatable, :registerable
5
- end
5
+ end
@@ -1,7 +1,7 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
- <title>Rails41App</title>
4
+ <title>Rails60App</title>
5
5
  <%= csrf_meta_tags %>
6
6
  </head>
7
7
  <body>
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../config/application', __dir__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fileutils'
3
+
4
+ # path to your application root.
5
+ APP_ROOT = File.expand_path('..', __dir__)
6
+
7
+ def system!(*args)
8
+ system(*args) || abort("\n== Command #{args} failed ==")
9
+ end
10
+
11
+ FileUtils.chdir APP_ROOT do
12
+ # This script is a way to setup or update your development environment automatically.
13
+ # This script is idempotent, so that you can run it at anytime and get an expectable outcome.
14
+ # Add necessary setup steps to this file.
15
+
16
+ puts '== Installing dependencies =='
17
+ system! 'gem install bundler --conservative'
18
+ system('bundle check') || system!('bundle install')
19
+
20
+ # puts "\n== Copying sample files =="
21
+ # unless File.exist?('config/database.yml')
22
+ # FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
23
+ # end
24
+
25
+ puts "\n== Preparing database =="
26
+ system! 'bin/rails db:prepare'
27
+
28
+ puts "\n== Removing old logs and tempfiles =="
29
+ system! 'bin/rails log:clear tmp:clear'
30
+
31
+ puts "\n== Restarting application server =="
32
+ system! 'bin/rails restart'
33
+ end
@@ -0,0 +1,17 @@
1
+ require_relative 'boot'
2
+
3
+ require "active_model/railtie"
4
+ require "active_record/railtie"
5
+ require "action_controller/railtie"
6
+ require "action_view/railtie"
7
+
8
+ # Require the gems listed in Gemfile, including any gems
9
+ # you've limited to :test, :development, or :production.
10
+ Bundler.require(*Rails.groups)
11
+
12
+ module Rails60App
13
+ class Application < Rails::Application
14
+ config.load_defaults 6.0
15
+ config.generators.system_tests = nil
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2
+
3
+ require 'bundler/setup' # Set up gems listed in the Gemfile.
@@ -0,0 +1 @@
1
+ zgiCn1x7CnSOIdb28q/qf9+IUL/DReQMZheOw/z3Jw126vMXmOgPAxlgF1coRpiQM1SJov9e+x2qdMV7v1XPoP5j7Fx+OihptIJkLBX3jBllqo6RU7rCG3G0e3n55NTX88y68PqiGi9gJjtITHl1n46dI49WcFubUn0WqIBcwngpHciWOU/EuSEl16nMQuupB6hUM7MEt70TynYKxV4xWA0N5K52Vp4n6xtG83J+jc+KmGd1su+Dn0PUnml15r0Gw47PLjUiyFfAvGnjWkd552l/2ga14zMOUXDadQhj6zhchbUDwpBWjH5aFWqz35ybHGaUgxFPMOuZXEN4esVqo7hGXJnnrr+GtootYMZzVvRP8M23hKwKesOp9zTokoKQAyLgRJPzwn1WDzbmj0/cb7IqvfCpjVRyYIXZ--njTP2mkB3sqImwao--o6xwiGZwEktvYPYSNZ+saw==
@@ -0,0 +1,31 @@
1
+ # SQLite. Versions 3.8.0 and up are supported.
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ #
7
+ default: &default
8
+ adapter: sqlite3
9
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10
+ timeout: 5000
11
+
12
+ development:
13
+ adapter: sqlite3
14
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
15
+ timeout: 5000
16
+ database: db/development.sqlite3
17
+
18
+ # Warning: The database defined as "test" will be erased and
19
+ # re-generated from your development database when you run "rake".
20
+ # Do not set this db to the same as development or production.
21
+ test:
22
+ adapter: sqlite3
23
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
24
+ timeout: 5000
25
+ database: db/test.sqlite3
26
+
27
+ production:
28
+ adapter: sqlite3
29
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
30
+ timeout: 5000
31
+ database: db/production.sqlite3
@@ -1,5 +1,5 @@
1
1
  # Load the Rails application.
2
- require File.expand_path("../application", __FILE__)
2
+ require_relative 'application'
3
3
 
4
4
  # Initialize the Rails application.
5
5
  Rails.application.initialize!
@@ -0,0 +1,47 @@
1
+ Rails.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.
13
+ config.consider_all_requests_local = true
14
+
15
+ # Enable/disable caching. By default caching is disabled.
16
+ # Run rails dev:cache to toggle caching.
17
+ if Rails.root.join('tmp', 'caching-dev.txt').exist?
18
+ config.action_controller.perform_caching = true
19
+ config.action_controller.enable_fragment_cache_logging = true
20
+
21
+ config.cache_store = :memory_store
22
+ config.public_file_server.headers = {
23
+ 'Cache-Control' => "public, max-age=#{2.days.to_i}"
24
+ }
25
+ else
26
+ config.action_controller.perform_caching = false
27
+
28
+ config.cache_store = :null_store
29
+ end
30
+
31
+ # Print deprecation notices to the Rails logger.
32
+ config.active_support.deprecation = :log
33
+
34
+ # Raise an error on page load if there are pending migrations.
35
+ config.active_record.migration_error = :page_load
36
+
37
+ # Highlight code that triggered database queries in logs.
38
+ config.active_record.verbose_query_logs = true
39
+
40
+
41
+ # Raises error for missing translations.
42
+ # config.action_view.raise_on_missing_translations = true
43
+
44
+ # Use an evented file watcher to asynchronously detect changes in source code,
45
+ # routes, locales, etc. This feature depends on the listen gem.
46
+ # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
47
+ end
@@ -0,0 +1,38 @@
1
+ # The test environment is used exclusively to run your application's
2
+ # test suite. You never need to work with it otherwise. Remember that
3
+ # your test database is "scratch space" for the test suite and is wiped
4
+ # and recreated between test runs. Don't rely on the data there!
5
+
6
+ Rails.application.configure do
7
+ # Settings specified here will take precedence over those in config/application.rb.
8
+
9
+ config.cache_classes = false
10
+
11
+ # Do not eager load code on boot. This avoids loading your whole application
12
+ # just for the purpose of running a single test. If you are using a tool that
13
+ # preloads Rails for running tests, you may have to set it to true.
14
+ config.eager_load = false
15
+
16
+ # Configure public file server for tests with Cache-Control for performance.
17
+ config.public_file_server.enabled = true
18
+ config.public_file_server.headers = {
19
+ 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
20
+ }
21
+
22
+ # Show full error reports and disable caching.
23
+ config.consider_all_requests_local = true
24
+ config.action_controller.perform_caching = false
25
+ config.cache_store = :null_store
26
+
27
+ # Raise exceptions instead of rendering exception templates.
28
+ config.action_dispatch.show_exceptions = false
29
+
30
+ # Disable request forgery protection in test environment.
31
+ config.action_controller.allow_forgery_protection = false
32
+
33
+ # Print deprecation notices to the stderr.
34
+ config.active_support.deprecation = :stderr if Rails.gem_version < Gem::Version.new("7.1")
35
+
36
+ # Raises error for missing translations.
37
+ # config.action_view.raise_on_missing_translations = true
38
+ end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Specify a serializer for the signed and encrypted cookie jars.
4
+ # Valid options are :json, :marshal, and :hybrid.
5
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -1,10 +1,18 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Use this hook to configure devise mailer, warden hooks and so forth.
2
4
  # Many of these configuration options can be set straight in your model.
3
5
  Devise.setup do |config|
4
6
  # The secret key used by Devise. Devise uses this key to generate
5
7
  # random tokens. Changing this key will render invalid all existing
6
8
  # confirmation, reset password and unlock tokens in the database.
7
- # config.secret_key = 'e757e9f98c1f53b25c1adef7d90a786c4224a963b67ec3e0011b89cc5c1349a46423d4ae047aa0ca57e658154996ab281439fea2ea5185f5c3dadcd8fb878472'
9
+ # Devise will use the `secret_key_base` as its `secret_key`
10
+ # by default. You can change it below and use your own secret key.
11
+ # config.secret_key = '3ce894ad0871a4451814ca5019bba2ac2fedffd32bddc34c102b695baeff79b5c31f26d3fe758f96ef4bbb155325755aa13fae472470c0b0c71f378195dac0a2'
12
+
13
+ # ==> Controller configuration
14
+ # Configure the parent class to the devise controllers.
15
+ # config.parent_controller = 'DeviseController'
8
16
 
9
17
  # ==> Mailer Configuration
10
18
  # Configure the e-mail address which will be shown in Devise::Mailer,
@@ -15,6 +23,9 @@ Devise.setup do |config|
15
23
  # Configure the class responsible to send e-mails.
16
24
  # config.mailer = 'Devise::Mailer'
17
25
 
26
+ # Configure the parent class responsible to send e-mails.
27
+ # config.parent_mailer = 'ActionMailer::Base'
28
+
18
29
  # ==> ORM configuration
19
30
  # Load and configure the ORM. Supports :active_record (default) and
20
31
  # :mongoid (bson_ext recommended) by default. Other ORMs may be
@@ -29,7 +40,7 @@ Devise.setup do |config|
29
40
  # session. If you need permissions, you should implement that in a before filter.
30
41
  # You can also supply a hash where the value is a boolean determining whether
31
42
  # or not authentication should be aborted when the value is not present.
32
- # config.authentication_keys = [ :email ]
43
+ # config.authentication_keys = [:email]
33
44
 
34
45
  # Configure parameters from the request object used for authentication. Each entry
35
46
  # given should be a request method and it will automatically be passed to the
@@ -41,12 +52,12 @@ Devise.setup do |config|
41
52
  # Configure which authentication keys should be case-insensitive.
42
53
  # These keys will be downcased upon creating or modifying a user and when used
43
54
  # to authenticate or find a user. Default is :email.
44
- config.case_insensitive_keys = [ :email ]
55
+ config.case_insensitive_keys = [:email]
45
56
 
46
57
  # Configure which authentication keys should have whitespace stripped.
47
58
  # These keys will have whitespace before and after removed upon creating or
48
59
  # modifying a user and when used to authenticate or find a user. Default is :email.
49
- config.strip_whitespace_keys = [ :email ]
60
+ config.strip_whitespace_keys = [:email]
50
61
 
51
62
  # Tell if authentication through request.params is enabled. True by default.
52
63
  # It can be set to an array that will enable params authentication only for the
@@ -61,7 +72,7 @@ Devise.setup do |config|
61
72
  # :database = Support basic authentication with authentication key + password
62
73
  # config.http_authenticatable = false
63
74
 
64
- # If http headers should be returned for AJAX requests. True by default.
75
+ # If 401 status code should be returned for AJAX requests. True by default.
65
76
  # config.http_authenticatable_on_xhr = true
66
77
 
67
78
  # The realm used in Http Basic Authentication. 'Application' by default.
@@ -76,7 +87,7 @@ Devise.setup do |config|
76
87
  # particular strategies by setting this option.
77
88
  # Notice that if you are skipping storage for all authentication paths, you
78
89
  # may want to disable generating routes to Devise's sessions controller by
79
- # passing :skip => :sessions to `devise_for` in your config/routes.rb
90
+ # passing skip: :sessions to `devise_for` in your config/routes.rb
80
91
  config.skip_session_storage = [:http_auth]
81
92
 
82
93
  # By default, Devise cleans up the CSRF token on authentication to
@@ -85,24 +96,41 @@ Devise.setup do |config|
85
96
  # from the server. You can disable this option at your own risk.
86
97
  # config.clean_up_csrf_token_on_authentication = true
87
98
 
99
+ # When false, Devise will not attempt to reload routes on eager load.
100
+ # This can reduce the time taken to boot the app but if your application
101
+ # requires the Devise mappings to be loaded during boot time the application
102
+ # won't boot properly.
103
+ # config.reload_routes = true
104
+
88
105
  # ==> Configuration for :database_authenticatable
89
- # For bcrypt, this is the cost for hashing the password and defaults to 10. If
90
- # using other encryptors, it sets how many times you want the password re-encrypted.
106
+ # For bcrypt, this is the cost for hashing the password and defaults to 11. If
107
+ # using other algorithms, it sets how many times you want the password to be hashed.
91
108
  #
92
109
  # Limiting the stretches to just one in testing will increase the performance of
93
110
  # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
94
- # a value less than 10 in other environments.
95
- config.stretches = Rails.env.test? ? 1 : 10
111
+ # a value less than 10 in other environments. Note that, for bcrypt (the default
112
+ # algorithm), the cost increases exponentially with the number of stretches (e.g.
113
+ # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
114
+ config.stretches = Rails.env.test? ? 1 : 11
96
115
 
97
- # Setup a pepper to generate the encrypted password.
98
- # config.pepper = '267f77e7a8218e1066a6820bdf87edfa152fb3fba5e8a9ec063732dcbdd24e7ee6ae7a13620e1f32f291e8d9cd276c2514ad04c951d450d4da2fba08ae660350'
116
+ # Set up a pepper to generate the hashed password.
117
+ # config.pepper = 'd64b4cef910bb0e6168bcedc12d73b2b4e1419fff4de5058dfd43ded50beb2b917ce5e538731e146c3ef3661372966c65886253ca967ce3719802a943838690d'
118
+
119
+ # Send a notification to the original email when the user's email is changed.
120
+ # config.send_email_changed_notification = false
121
+
122
+ # Send a notification email when the user's password is changed.
123
+ # config.send_password_change_notification = false
99
124
 
100
125
  # ==> Configuration for :confirmable
101
126
  # A period that the user is allowed to access the website even without
102
127
  # confirming their account. For instance, if set to 2.days, the user will be
103
128
  # able to access the website for two days without confirming their account,
104
- # access will be blocked just in the third day. Default is 0.days, meaning
105
- # the user cannot access the website without confirming their account.
129
+ # access will be blocked just in the third day.
130
+ # You can also set it to nil, which will allow the user to access the website
131
+ # without confirming their account.
132
+ # Default is 0.days, meaning the user cannot access the website without
133
+ # confirming their account.
106
134
  # config.allow_unconfirmed_access_for = 2.days
107
135
 
108
136
  # A period that the user is allowed to confirm their account before their
@@ -115,41 +143,41 @@ Devise.setup do |config|
115
143
 
116
144
  # If true, requires any email changes to be confirmed (exactly the same way as
117
145
  # initial account confirmation) to be applied. Requires additional unconfirmed_email
118
- # db field (see migrations). Until confirmed new email is stored in
119
- # unconfirmed email column, and copied to email column on successful confirmation.
146
+ # db field (see migrations). Until confirmed, new email is stored in
147
+ # unconfirmed_email column, and copied to email column on successful confirmation.
120
148
  config.reconfirmable = true
121
149
 
122
150
  # Defines which key will be used when confirming an account
123
- # config.confirmation_keys = [ :email ]
151
+ # config.confirmation_keys = [:email]
124
152
 
125
153
  # ==> Configuration for :rememberable
126
154
  # The time the user will be remembered without asking for credentials again.
127
155
  # config.remember_for = 2.weeks
128
156
 
157
+ # Invalidates all the remember me tokens when the user signs out.
158
+ config.expire_all_remember_me_on_sign_out = true
159
+
129
160
  # If true, extends the user's remember period when remembered via cookie.
130
161
  # config.extend_remember_period = false
131
162
 
132
163
  # Options to be passed to the created cookie. For instance, you can set
133
- # :secure => true in order to force SSL only cookies.
164
+ # secure: true in order to force SSL only cookies.
134
165
  # config.rememberable_options = {}
135
166
 
136
167
  # ==> Configuration for :validatable
137
168
  # Range for password length.
138
- config.password_length = 8..128
169
+ config.password_length = 6..128
139
170
 
140
171
  # Email regex used to validate email formats. It simply asserts that
141
172
  # one (and only one) @ exists in the given string. This is mainly
142
173
  # to give user feedback and not to assert the e-mail validity.
143
- # config.email_regexp = /\A[^@]+@[^@]+\z/
174
+ config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
144
175
 
145
176
  # ==> Configuration for :timeoutable
146
177
  # The time you want to timeout the user session without activity. After this
147
178
  # time the user will be asked for credentials again. Default is 30 minutes.
148
179
  # config.timeout_in = 30.minutes
149
180
 
150
- # If true, expires auth token on session timeout.
151
- # config.expire_auth_token_on_timeout = false
152
-
153
181
  # ==> Configuration for :lockable
154
182
  # Defines which strategy will be used to lock an account.
155
183
  # :failed_attempts = Locks an account after a number of failed attempts to sign in.
@@ -157,7 +185,7 @@ Devise.setup do |config|
157
185
  # config.lock_strategy = :failed_attempts
158
186
 
159
187
  # Defines which key will be used when locking and unlocking an account
160
- # config.unlock_keys = [ :email ]
188
+ # config.unlock_keys = [:email]
161
189
 
162
190
  # Defines which strategy will be used to unlock an account.
163
191
  # :email = Sends an unlock link to the user email
@@ -174,24 +202,28 @@ Devise.setup do |config|
174
202
  # config.unlock_in = 1.hour
175
203
 
176
204
  # Warn on the last attempt before the account is locked.
177
- # config.last_attempt_warning = false
205
+ # config.last_attempt_warning = true
178
206
 
179
207
  # ==> Configuration for :recoverable
180
208
  #
181
209
  # Defines which key will be used when recovering the password for an account
182
- # config.reset_password_keys = [ :email ]
210
+ # config.reset_password_keys = [:email]
183
211
 
184
212
  # Time interval you can reset your password with a reset password key.
185
213
  # Don't put a too small interval or your users won't have the time to
186
214
  # change their passwords.
187
215
  config.reset_password_within = 6.hours
188
216
 
217
+ # When set to false, does not sign a user in automatically after their password is
218
+ # reset. Defaults to true, so a user is signed in automatically after a reset.
219
+ # config.sign_in_after_reset_password = true
220
+
189
221
  # ==> Configuration for :encryptable
190
- # Allow you to use another encryption algorithm besides bcrypt (default). You can use
191
- # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
192
- # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
193
- # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
194
- # REST_AUTH_SITE_KEY to pepper).
222
+ # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
223
+ # You can use :sha1, :sha512 or algorithms from others authentication tools as
224
+ # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
225
+ # for default behavior) and :restful_authentication_sha1 (then you should set
226
+ # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
195
227
  #
196
228
  # Require the `devise-encryptable` gem when using anything other than bcrypt
197
229
  # config.encryptor = :sha512
@@ -227,7 +259,7 @@ Devise.setup do |config|
227
259
  # ==> OmniAuth
228
260
  # Add a new OmniAuth provider. Check the wiki for more information on setting
229
261
  # up on your models and hooks.
230
- # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
262
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
231
263
 
232
264
  # ==> Warden configuration
233
265
  # If you want to use other strategies, that are not supported by Devise, or
@@ -235,7 +267,7 @@ Devise.setup do |config|
235
267
  #
236
268
  # config.warden do |manager|
237
269
  # manager.intercept_401 = false
238
- # manager.default_strategies(:scope => :user).unshift :some_external_strategy
270
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
239
271
  # end
240
272
 
241
273
  # ==> Mountable engine configurations
@@ -248,7 +280,20 @@ Devise.setup do |config|
248
280
  # The router that invoked `devise_for`, in the example above, would be:
249
281
  # config.router_name = :my_engine
250
282
  #
251
- # When using omniauth, Devise cannot automatically set Omniauth path,
283
+ # When using OmniAuth, Devise cannot automatically set OmniAuth path,
252
284
  # so you need to do it manually. For the users scope, it would be:
253
285
  # config.omniauth_path_prefix = '/my_engine/users/auth'
286
+
287
+ # ==> Turbolinks configuration
288
+ # If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly:
289
+ #
290
+ # ActiveSupport.on_load(:devise_failure_app) do
291
+ # include Turbolinks::Controller
292
+ # end
293
+
294
+ # ==> Configuration for :registerable
295
+
296
+ # When set to false, does not sign a user in automatically after their password is
297
+ # changed. Defaults to true, so a user is signed in automatically after changing a password.
298
+ # config.sign_in_after_change_password = true
254
299
  end
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json]
9
+ end
10
+
11
+ # To enable root element in JSON for ActiveRecord objects.
12
+ # ActiveSupport.on_load(:active_record) do
13
+ # self.include_root_in_json = true
14
+ # end
@@ -3,26 +3,30 @@
3
3
  en:
4
4
  devise:
5
5
  confirmations:
6
- confirmed: "Your account was successfully confirmed."
7
- send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
8
- send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes."
6
+ confirmed: "Your email address has been successfully confirmed."
7
+ send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
8
+ send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
9
9
  failure:
10
10
  already_authenticated: "You are already signed in."
11
11
  inactive: "Your account is not activated yet."
12
- invalid: "Invalid email or password."
12
+ invalid: "Invalid %{authentication_keys} or password."
13
13
  locked: "Your account is locked."
14
- last_attempt: "You have one more attempt before your account will be locked."
15
- not_found_in_database: "Invalid email or password."
14
+ last_attempt: "You have one more attempt before your account is locked."
15
+ not_found_in_database: "Invalid %{authentication_keys} or password."
16
16
  timeout: "Your session expired. Please sign in again to continue."
17
17
  unauthenticated: "You need to sign in or sign up before continuing."
18
- unconfirmed: "You have to confirm your account before continuing."
18
+ unconfirmed: "You have to confirm your email address before continuing."
19
19
  mailer:
20
20
  confirmation_instructions:
21
21
  subject: "Confirmation instructions"
22
22
  reset_password_instructions:
23
23
  subject: "Reset password instructions"
24
24
  unlock_instructions:
25
- subject: "Unlock Instructions"
25
+ subject: "Unlock instructions"
26
+ email_changed:
27
+ subject: "Email Changed"
28
+ password_change:
29
+ subject: "Password Changed"
26
30
  omniauth_callbacks:
27
31
  failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
28
32
  success: "Successfully authenticated from %{kind} account."
@@ -30,22 +34,24 @@ en:
30
34
  no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
31
35
  send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
32
36
  send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
33
- updated: "Your password was changed successfully. You are now signed in."
34
- updated_not_active: "Your password was changed successfully."
37
+ updated: "Your password has been changed successfully. You are now signed in."
38
+ updated_not_active: "Your password has been changed successfully."
35
39
  registrations:
36
- destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon."
40
+ destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
37
41
  signed_up: "Welcome! You have signed up successfully."
38
42
  signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
39
43
  signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
40
- signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please open the link to activate your account."
41
- update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
42
- updated: "You updated your account successfully."
44
+ signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
45
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirmation link to confirm your new email address."
46
+ updated: "Your account has been updated successfully."
47
+ updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again"
43
48
  sessions:
44
49
  signed_in: "Signed in successfully."
45
50
  signed_out: "Signed out successfully."
51
+ already_signed_out: "Signed out successfully."
46
52
  unlocks:
47
- send_instructions: "You will receive an email with instructions about how to unlock your account in a few minutes."
48
- send_paranoid_instructions: "If your account exists, you will receive an email with instructions about how to unlock it in a few minutes."
53
+ send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
54
+ send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
49
55
  unlocked: "Your account has been unlocked successfully. Please sign in to continue."
50
56
  errors:
51
57
  messages:
@@ -16,8 +16,18 @@
16
16
  #
17
17
  # This would use the information in config/locales/es.yml.
18
18
  #
19
+ # The following keys must be escaped otherwise they will not be retrieved by
20
+ # the default I18n backend:
21
+ #
22
+ # true, false, on, off, yes, no
23
+ #
24
+ # Instead, surround them with single quotes.
25
+ #
26
+ # en:
27
+ # 'true': 'foo'
28
+ #
19
29
  # To learn more, please read the Rails Internationalization guide
20
- # available at http://guides.rubyonrails.org/i18n.html.
30
+ # available at https://guides.rubyonrails.org/i18n.html.
21
31
 
22
32
  en:
23
33
  hello: "Hello world"
@@ -0,0 +1 @@
1
+ 1ff9c60b166743878658e17106e718db
@@ -1,4 +1,5 @@
1
1
  Rails.application.routes.draw do
2
2
  devise_for :users
3
+ mount MyAppWrapped => "/rack_test"
3
4
  root :to => "home#index"
4
5
  end
@@ -1,4 +1,5 @@
1
1
  # This file is used by Rack-based servers to start the application.
2
2
 
3
- require ::File.expand_path('../config/environment', __FILE__)
3
+ require_relative 'config/environment'
4
+
4
5
  run Rails.application
@@ -1,4 +1,4 @@
1
- class AddDeviseUsers < ActiveRecord::Migration
1
+ class AddDeviseUsers < ActiveRecord::Migration[6.0]
2
2
  def change
3
3
  create_table(:users) do |t|
4
4
  t.string :email, :null => false, :default => ""
@@ -0,0 +1,23 @@
1
+ # This file is auto-generated from the current state of the database. Instead
2
+ # of editing this file, please use the migrations feature of Active Record to
3
+ # incrementally modify your database, and then regenerate this schema definition.
4
+ #
5
+ # This file is the source Rails uses to define your schema when running `rails
6
+ # db:schema:load`. When creating a new database, `rails db:schema:load` tends to
7
+ # be faster and is potentially less error prone than running all of your
8
+ # migrations from scratch. Old migrations may fail to apply correctly if those
9
+ # migrations use external dependencies or application code.
10
+ #
11
+ # It's strongly recommended that you check this file into your version control system.
12
+
13
+ ActiveRecord::Schema.define(version: 2020_04_27_115501) do
14
+
15
+ create_table "users", force: :cascade do |t|
16
+ t.string "email", default: "", null: false
17
+ t.string "encrypted_password", default: "", null: false
18
+ t.datetime "created_at", precision: 6, null: false
19
+ t.datetime "updated_at", precision: 6, null: false
20
+ t.index ["email"], name: "index_users_on_email", unique: true
21
+ end
22
+
23
+ end