devise-2fa 0.1.1 → 0.2.0
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.
- checksums.yaml +5 -5
- data/.circleci/config.yml +46 -0
- data/.gitignore +8 -0
- data/Gemfile +3 -22
- data/README.md +13 -14
- data/Rakefile +6 -28
- data/bin/rspec +10 -0
- data/bin/setup +12 -0
- data/{devise-2fa.gemspec → devise_2fa.gemspec} +15 -8
- data/lib/devise-2fa/version.rb +1 -1
- data/lib/devise_two_factorable/models/two_factorable.rb +5 -1
- data/{test → spec}/dummy/Rakefile +2 -3
- data/{test/dummy/app/mailers/.gitkeep → spec/dummy/app/assets/images/.keep} +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +3 -0
- data/{test/dummy/lib/assets/.gitkeep → spec/dummy/app/assets/javascripts/channels/.keep} +0 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/{test → spec}/dummy/app/controllers/application_controller.rb +4 -1
- data/{test/dummy/public/favicon.ico → spec/dummy/app/controllers/concerns/.keep} +0 -0
- data/{test → spec}/dummy/app/helpers/application_helper.rb +0 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/models/user.rb +6 -0
- data/spec/dummy/app/views/layouts/application.html.erb +19 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +25 -0
- data/spec/dummy/bin/update +25 -0
- data/spec/dummy/bin/yarn +11 -0
- data/spec/dummy/config.ru +5 -0
- data/spec/dummy/config/application.rb +14 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/{test → spec}/dummy/config/database.yml +10 -10
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +61 -0
- data/{test → spec}/dummy/config/environments/test.rb +15 -5
- data/spec/dummy/config/initializers/assets.rb +4 -0
- data/{test → spec}/dummy/config/initializers/backtrace_silencers.rb +0 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/{test → spec}/dummy/config/initializers/devise.rb +134 -56
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/{test → spec}/dummy/config/initializers/inflections.rb +6 -5
- data/{test → spec}/dummy/config/initializers/mime_types.rb +0 -1
- data/{test → spec}/dummy/config/initializers/wrap_parameters.rb +5 -5
- data/spec/dummy/config/locales/devise.en.yml +68 -0
- data/spec/dummy/config/locales/devise.two_factor.en.yml +57 -0
- data/spec/dummy/config/locales/en.yml +2 -0
- data/spec/dummy/config/puma.rb +9 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/config/spring.rb +6 -0
- data/spec/dummy/config/storage.yml +8 -0
- data/spec/dummy/db/migrate/20190311184605_devise_create_users.rb +44 -0
- data/{test/dummy/db/migrate/20130131160351_devise_otp_add_to_users.rb → spec/dummy/db/migrate/20190312222952_devise_two_factor_add_to_users.rb} +4 -5
- data/spec/dummy/db/schema.rb +39 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/package.json +5 -0
- data/spec/dummy/public/404.html +1 -0
- data/spec/dummy/public/422.html +1 -0
- data/spec/dummy/public/500.html +19 -0
- data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/storage/.keep +0 -0
- data/spec/models/user_spec.rb +33 -0
- data/spec/spec_helper.rb +69 -0
- data/spec/system/persistence_spec.rb +59 -0
- data/spec/system/refresh_spec.rb +100 -0
- data/spec/system/token_spec.rb +41 -0
- data/spec/system/users_spec.rb +98 -0
- metadata +213 -123
- data/.travis.yml +0 -28
- data/lib/devise_two_factorable/two_factorable.rb +0 -131
- data/test/dummy/README.rdoc +0 -261
- data/test/dummy/app/assets/javascripts/application.js +0 -13
- data/test/dummy/app/assets/stylesheets/application.css +0 -13
- data/test/dummy/app/controllers/posts_controller.rb +0 -83
- data/test/dummy/app/helpers/posts_helper.rb +0 -2
- data/test/dummy/app/models/post.rb +0 -2
- data/test/dummy/app/models/user.rb +0 -20
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/app/views/posts/_form.html.erb +0 -25
- data/test/dummy/app/views/posts/edit.html.erb +0 -6
- data/test/dummy/app/views/posts/index.html.erb +0 -25
- data/test/dummy/app/views/posts/new.html.erb +0 -5
- data/test/dummy/app/views/posts/show.html.erb +0 -15
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -67
- data/test/dummy/config/boot.rb +0 -10
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -37
- data/test/dummy/config/environments/production.rb +0 -73
- data/test/dummy/config/initializers/secret_token.rb +0 -8
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/locales/en.yml +0 -5
- data/test/dummy/config/routes.rb +0 -6
- data/test/dummy/db/migrate/20130125101430_create_users.rb +0 -9
- data/test/dummy/db/migrate/20130131092406_add_devise_to_users.rb +0 -52
- data/test/dummy/db/migrate/20130131142320_create_posts.rb +0 -10
- data/test/dummy/public/404.html +0 -26
- data/test/dummy/public/422.html +0 -26
- data/test/dummy/public/500.html +0 -25
- data/test/dummy/script/rails +0 -6
- data/test/integration/persistence_test.rb +0 -63
- data/test/integration/refresh_test.rb +0 -103
- data/test/integration/sign_in_test.rb +0 -85
- data/test/integration/token_test.rb +0 -30
- data/test/integration_tests_helper.rb +0 -64
- data/test/model_tests_helper.rb +0 -20
- data/test/models/two_factorable_test.rb +0 -120
- data/test/orm/active_record.rb +0 -4
- data/test/orm/mongoid.rb +0 -13
- data/test/support/mongoid.yml +0 -6
- data/test/support/symmetric_encryption.yml +0 -70
- data/test/test_helper.rb +0 -18
data/spec/dummy/bin/yarn
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path('..', __dir__)
|
3
|
+
Dir.chdir(APP_ROOT) do
|
4
|
+
begin
|
5
|
+
exec "yarnpkg", *ARGV
|
6
|
+
rescue Errno::ENOENT
|
7
|
+
$stderr.puts "Yarn executable was not detected in the system."
|
8
|
+
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
|
9
|
+
exit 1
|
10
|
+
end
|
11
|
+
end
|
@@ -3,23 +3,23 @@
|
|
3
3
|
#
|
4
4
|
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
5
|
# gem 'sqlite3'
|
6
|
-
|
6
|
+
#
|
7
|
+
default: &default
|
7
8
|
adapter: sqlite3
|
8
|
-
|
9
|
-
pool: 5
|
9
|
+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
10
10
|
timeout: 5000
|
11
11
|
|
12
|
+
development:
|
13
|
+
<<: *default
|
14
|
+
database: db/development.sqlite3
|
15
|
+
|
12
16
|
# Warning: The database defined as "test" will be erased and
|
13
17
|
# re-generated from your development database when you run "rake".
|
14
18
|
# Do not set this db to the same as development or production.
|
15
19
|
test:
|
16
|
-
|
17
|
-
database:
|
18
|
-
pool: 5
|
19
|
-
timeout: 5000
|
20
|
+
<<: *default
|
21
|
+
database: db/test.sqlite3
|
20
22
|
|
21
23
|
production:
|
22
|
-
|
24
|
+
<<: *default
|
23
25
|
database: db/production.sqlite3
|
24
|
-
pool: 5
|
25
|
-
timeout: 5000
|
@@ -0,0 +1,61 @@
|
|
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
|
+
|
20
|
+
config.cache_store = :memory_store
|
21
|
+
config.public_file_server.headers = {
|
22
|
+
'Cache-Control' => "public, max-age=#{2.days.to_i}"
|
23
|
+
}
|
24
|
+
else
|
25
|
+
config.action_controller.perform_caching = false
|
26
|
+
|
27
|
+
config.cache_store = :null_store
|
28
|
+
end
|
29
|
+
|
30
|
+
# Store uploaded files on the local file system (see config/storage.yml for options)
|
31
|
+
config.active_storage.service = :local
|
32
|
+
|
33
|
+
# Don't care if the mailer can't send.
|
34
|
+
config.action_mailer.raise_delivery_errors = false
|
35
|
+
|
36
|
+
config.action_mailer.perform_caching = false
|
37
|
+
|
38
|
+
# Print deprecation notices to the Rails logger.
|
39
|
+
config.active_support.deprecation = :log
|
40
|
+
|
41
|
+
# Raise an error on page load if there are pending migrations.
|
42
|
+
config.active_record.migration_error = :page_load
|
43
|
+
|
44
|
+
# Highlight code that triggered database queries in logs.
|
45
|
+
config.active_record.verbose_query_logs = true
|
46
|
+
|
47
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
48
|
+
# This option may cause significant delays in view rendering with a large
|
49
|
+
# number of complex assets.
|
50
|
+
config.assets.debug = true
|
51
|
+
|
52
|
+
# Suppress logger output for asset requests.
|
53
|
+
config.assets.quiet = true
|
54
|
+
|
55
|
+
# Raises error for missing translations
|
56
|
+
# config.action_view.raise_on_missing_translations = true
|
57
|
+
|
58
|
+
# Use an evented file watcher to asynchronously detect changes in source code,
|
59
|
+
# routes, locales, etc. This feature depends on the listen gem.
|
60
|
+
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
61
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
Rails.application.configure do
|
2
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
|
@@ -12,9 +12,11 @@ Dummy::Application.configure do
|
|
12
12
|
# preloads Rails for running tests, you may have to set it to true.
|
13
13
|
config.eager_load = false
|
14
14
|
|
15
|
-
# Configure
|
16
|
-
config.
|
17
|
-
config.
|
15
|
+
# Configure public file server for tests with Cache-Control for performance
|
16
|
+
config.public_file_server.enabled = true
|
17
|
+
config.public_file_server.headers = {
|
18
|
+
'Cache-Control' => "public, max-age=#{1.hour.to_i}"
|
19
|
+
}
|
18
20
|
|
19
21
|
# Show full error reports and disable caching
|
20
22
|
config.consider_all_requests_local = true
|
@@ -26,11 +28,19 @@ Dummy::Application.configure do
|
|
26
28
|
# Disable request forgery protection in test environment
|
27
29
|
config.action_controller.allow_forgery_protection = false
|
28
30
|
|
29
|
-
#
|
31
|
+
# Store uploaded files on the local file system in a temporary directory
|
32
|
+
config.active_storage.service = :test
|
33
|
+
|
34
|
+
config.action_mailer.perform_caching = false
|
35
|
+
|
36
|
+
# Tell Action Mailer not to deliver emails to the real world
|
30
37
|
# The :test delivery method accumulates sent emails in the
|
31
38
|
# ActionMailer::Base.deliveries array.
|
32
39
|
config.action_mailer.delivery_method = :test
|
33
40
|
|
34
41
|
# Print deprecation notices to the stderr
|
35
42
|
config.active_support.deprecation = :stderr
|
43
|
+
|
44
|
+
# Raises error for missing translations
|
45
|
+
# config.action_view.raise_on_missing_translations = true
|
36
46
|
end
|
File without changes
|
@@ -1,15 +1,30 @@
|
|
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
|
7
|
+
# random tokens. Changing this key will render invalid all existing
|
8
|
+
# confirmation, reset password and unlock tokens in the database.
|
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 = '4e16edbe729fb51c9803b5397d7ea7827a6d8e6cd8a7fe8b09810652b9458afb623a14850fafdeee853815c09b140d3552eac721f571d8673f0e1be6c4707567'
|
12
|
+
|
13
|
+
# ==> Controller configuration
|
14
|
+
# Configure the parent class to the devise controllers.
|
15
|
+
# config.parent_controller = 'DeviseController'
|
5
16
|
|
6
17
|
# ==> Mailer Configuration
|
7
18
|
# Configure the e-mail address which will be shown in Devise::Mailer,
|
8
|
-
# note that it will be overwritten if you use your own mailer class
|
19
|
+
# note that it will be overwritten if you use your own mailer class
|
20
|
+
# with default "from" parameter.
|
9
21
|
config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
|
10
22
|
|
11
23
|
# Configure the class responsible to send e-mails.
|
12
|
-
# config.mailer =
|
24
|
+
# config.mailer = 'Devise::Mailer'
|
25
|
+
|
26
|
+
# Configure the parent class responsible to send e-mails.
|
27
|
+
# config.parent_mailer = 'ActionMailer::Base'
|
13
28
|
|
14
29
|
# ==> ORM configuration
|
15
30
|
# Load and configure the ORM. Supports :active_record (default) and
|
@@ -25,7 +40,7 @@ Devise.setup do |config|
|
|
25
40
|
# session. If you need permissions, you should implement that in a before filter.
|
26
41
|
# You can also supply a hash where the value is a boolean determining whether
|
27
42
|
# or not authentication should be aborted when the value is not present.
|
28
|
-
# config.authentication_keys = [
|
43
|
+
# config.authentication_keys = [:email]
|
29
44
|
|
30
45
|
# Configure parameters from the request object used for authentication. Each entry
|
31
46
|
# given should be a request method and it will automatically be passed to the
|
@@ -50,17 +65,18 @@ Devise.setup do |config|
|
|
50
65
|
# enable it only for database (email + password) authentication.
|
51
66
|
# config.params_authenticatable = true
|
52
67
|
|
53
|
-
# Tell if authentication through HTTP
|
68
|
+
# Tell if authentication through HTTP Auth is enabled. False by default.
|
54
69
|
# It can be set to an array that will enable http authentication only for the
|
55
|
-
# given strategies, for example, `config.http_authenticatable = [:
|
56
|
-
# enable it only for
|
70
|
+
# given strategies, for example, `config.http_authenticatable = [:database]` will
|
71
|
+
# enable it only for database authentication. The supported strategies are:
|
72
|
+
# :database = Support basic authentication with authentication key + password
|
57
73
|
# config.http_authenticatable = false
|
58
74
|
|
59
|
-
# If
|
75
|
+
# If 401 status code should be returned for AJAX requests. True by default.
|
60
76
|
# config.http_authenticatable_on_xhr = true
|
61
77
|
|
62
|
-
# The realm used in Http Basic Authentication.
|
63
|
-
# config.http_authentication_realm =
|
78
|
+
# The realm used in Http Basic Authentication. 'Application' by default.
|
79
|
+
# config.http_authentication_realm = 'Application'
|
64
80
|
|
65
81
|
# It will change confirmation, password recovery and other workflows
|
66
82
|
# to behave the same regardless if the e-mail provided was right or wrong.
|
@@ -68,30 +84,53 @@ Devise.setup do |config|
|
|
68
84
|
# config.paranoid = true
|
69
85
|
|
70
86
|
# By default Devise will store the user in session. You can skip storage for
|
71
|
-
#
|
87
|
+
# particular strategies by setting this option.
|
72
88
|
# Notice that if you are skipping storage for all authentication paths, you
|
73
89
|
# may want to disable generating routes to Devise's sessions controller by
|
74
|
-
# passing :
|
90
|
+
# passing skip: :sessions to `devise_for` in your config/routes.rb
|
75
91
|
config.skip_session_storage = [:http_auth]
|
76
92
|
|
93
|
+
# By default, Devise cleans up the CSRF token on authentication to
|
94
|
+
# avoid CSRF token fixation attacks. This means that, when using AJAX
|
95
|
+
# requests for sign in and sign up, you need to get a new CSRF token
|
96
|
+
# from the server. You can disable this option at your own risk.
|
97
|
+
# config.clean_up_csrf_token_on_authentication = true
|
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
|
+
|
77
105
|
# ==> Configuration for :database_authenticatable
|
78
|
-
# For bcrypt, this is the cost for hashing the password and defaults to
|
79
|
-
# using other
|
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.
|
80
108
|
#
|
81
109
|
# Limiting the stretches to just one in testing will increase the performance of
|
82
110
|
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
83
|
-
# a value less than 10 in other environments.
|
84
|
-
|
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
|
85
115
|
|
86
|
-
#
|
87
|
-
# config.pepper =
|
116
|
+
# Set up a pepper to generate the hashed password.
|
117
|
+
# config.pepper = '4312e46c55ef25d4a6c9c2e2cdb6e6f4a3bfc5f54000df6e1f59d7722a2c9597ea1721c239e955b4f8cb726753d1081b4bbcd52a4ad3f891e0e2574964d2f651'
|
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
|
88
124
|
|
89
125
|
# ==> Configuration for :confirmable
|
90
126
|
# A period that the user is allowed to access the website even without
|
91
|
-
# confirming
|
92
|
-
# able to access the website for two days without confirming
|
93
|
-
# access will be blocked just in the third day.
|
94
|
-
# the user
|
127
|
+
# confirming their account. For instance, if set to 2.days, the user will be
|
128
|
+
# able to access the website for two days 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.
|
95
134
|
# config.allow_unconfirmed_access_for = 2.days
|
96
135
|
|
97
136
|
# A period that the user is allowed to confirm their account before their
|
@@ -104,41 +143,41 @@ Devise.setup do |config|
|
|
104
143
|
|
105
144
|
# If true, requires any email changes to be confirmed (exactly the same way as
|
106
145
|
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
107
|
-
# db field (see migrations). Until confirmed new email is stored in
|
108
|
-
#
|
146
|
+
# db field (see migrations). Until confirmed, new email is stored in
|
147
|
+
# unconfirmed_email column, and copied to email column on successful confirmation.
|
109
148
|
config.reconfirmable = true
|
110
149
|
|
111
150
|
# Defines which key will be used when confirming an account
|
112
|
-
# config.confirmation_keys = [
|
151
|
+
# config.confirmation_keys = [:email]
|
113
152
|
|
114
153
|
# ==> Configuration for :rememberable
|
115
154
|
# The time the user will be remembered without asking for credentials again.
|
116
155
|
# config.remember_for = 2.weeks
|
117
156
|
|
157
|
+
# Invalidates all the remember me tokens when the user signs out.
|
158
|
+
config.expire_all_remember_me_on_sign_out = true
|
159
|
+
|
118
160
|
# If true, extends the user's remember period when remembered via cookie.
|
119
161
|
# config.extend_remember_period = false
|
120
162
|
|
121
163
|
# Options to be passed to the created cookie. For instance, you can set
|
122
|
-
# :
|
164
|
+
# secure: true in order to force SSL only cookies.
|
123
165
|
# config.rememberable_options = {}
|
124
166
|
|
125
167
|
# ==> Configuration for :validatable
|
126
|
-
# Range for password length.
|
127
|
-
config.password_length =
|
168
|
+
# Range for password length.
|
169
|
+
config.password_length = 6..128
|
128
170
|
|
129
171
|
# Email regex used to validate email formats. It simply asserts that
|
130
|
-
#
|
172
|
+
# one (and only one) @ exists in the given string. This is mainly
|
131
173
|
# to give user feedback and not to assert the e-mail validity.
|
132
|
-
|
174
|
+
config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
|
133
175
|
|
134
176
|
# ==> Configuration for :timeoutable
|
135
177
|
# The time you want to timeout the user session without activity. After this
|
136
178
|
# time the user will be asked for credentials again. Default is 30 minutes.
|
137
179
|
# config.timeout_in = 30.minutes
|
138
180
|
|
139
|
-
# If true, expires auth token on session timeout.
|
140
|
-
# config.expire_auth_token_on_timeout = false
|
141
|
-
|
142
181
|
# ==> Configuration for :lockable
|
143
182
|
# Defines which strategy will be used to lock an account.
|
144
183
|
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
@@ -146,7 +185,7 @@ Devise.setup do |config|
|
|
146
185
|
# config.lock_strategy = :failed_attempts
|
147
186
|
|
148
187
|
# Defines which key will be used when locking and unlocking an account
|
149
|
-
# config.unlock_keys = [
|
188
|
+
# config.unlock_keys = [:email]
|
150
189
|
|
151
190
|
# Defines which strategy will be used to unlock an account.
|
152
191
|
# :email = Sends an unlock link to the user email
|
@@ -162,28 +201,33 @@ Devise.setup do |config|
|
|
162
201
|
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
163
202
|
# config.unlock_in = 1.hour
|
164
203
|
|
204
|
+
# Warn on the last attempt before the account is locked.
|
205
|
+
# config.last_attempt_warning = true
|
206
|
+
|
165
207
|
# ==> Configuration for :recoverable
|
166
208
|
#
|
167
209
|
# Defines which key will be used when recovering the password for an account
|
168
|
-
# config.reset_password_keys = [
|
210
|
+
# config.reset_password_keys = [:email]
|
169
211
|
|
170
212
|
# Time interval you can reset your password with a reset password key.
|
171
213
|
# Don't put a too small interval or your users won't have the time to
|
172
214
|
# change their passwords.
|
173
215
|
config.reset_password_within = 6.hours
|
174
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
|
+
|
175
221
|
# ==> Configuration for :encryptable
|
176
|
-
# Allow you to use another encryption algorithm besides bcrypt (default).
|
177
|
-
# :sha1, :sha512 or
|
178
|
-
# :authlogic_sha512 (then you should set stretches above to 20
|
179
|
-
# and :restful_authentication_sha1 (then you should set
|
180
|
-
# 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).
|
227
|
+
#
|
228
|
+
# Require the `devise-encryptable` gem when using anything other than bcrypt
|
181
229
|
# config.encryptor = :sha512
|
182
230
|
|
183
|
-
# ==> Configuration for :token_authenticatable
|
184
|
-
# Defines name of the authentication token params key
|
185
|
-
# config.token_authentication_key = :auth_token
|
186
|
-
|
187
231
|
# ==> Scopes configuration
|
188
232
|
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
189
233
|
# "users/sessions/new". It's turned off by default because it's slower if you
|
@@ -207,7 +251,7 @@ Devise.setup do |config|
|
|
207
251
|
# should add them to the navigational formats lists.
|
208
252
|
#
|
209
253
|
# The "*/*" below is required to match Internet Explorer requests.
|
210
|
-
# config.navigational_formats = [
|
254
|
+
# config.navigational_formats = ['*/*', :html]
|
211
255
|
|
212
256
|
# The default HTTP method used to sign out a resource. Default is :delete.
|
213
257
|
config.sign_out_via = :delete
|
@@ -215,7 +259,7 @@ Devise.setup do |config|
|
|
215
259
|
# ==> OmniAuth
|
216
260
|
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
217
261
|
# up on your models and hooks.
|
218
|
-
# config.omniauth :github, 'APP_ID', 'APP_SECRET', :
|
262
|
+
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
|
219
263
|
|
220
264
|
# ==> Warden configuration
|
221
265
|
# If you want to use other strategies, that are not supported by Devise, or
|
@@ -223,7 +267,7 @@ Devise.setup do |config|
|
|
223
267
|
#
|
224
268
|
# config.warden do |manager|
|
225
269
|
# manager.intercept_401 = false
|
226
|
-
# manager.default_strategies(:
|
270
|
+
# manager.default_strategies(scope: :user).unshift :some_external_strategy
|
227
271
|
# end
|
228
272
|
|
229
273
|
# ==> Mountable engine configurations
|
@@ -231,21 +275,55 @@ Devise.setup do |config|
|
|
231
275
|
# is mountable, there are some extra configurations to be taken into account.
|
232
276
|
# The following options are available, assuming the engine is mounted as:
|
233
277
|
#
|
234
|
-
# mount MyEngine, at:
|
278
|
+
# mount MyEngine, at: '/my_engine'
|
235
279
|
#
|
236
280
|
# The router that invoked `devise_for`, in the example above, would be:
|
237
281
|
# config.router_name = :my_engine
|
238
282
|
#
|
239
|
-
# When using
|
283
|
+
# When using OmniAuth, Devise cannot automatically set OmniAuth path,
|
240
284
|
# so you need to do it manually. For the users scope, it would be:
|
241
|
-
# config.omniauth_path_prefix =
|
285
|
+
# config.omniauth_path_prefix = '/my_engine/users/auth'
|
242
286
|
|
243
|
-
# ==>
|
244
|
-
#
|
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
|
245
293
|
|
246
|
-
#
|
247
|
-
# config.otp_authentication_timeout = 3.minutes
|
294
|
+
# ==> Configuration for :registerable
|
248
295
|
|
249
|
-
#
|
250
|
-
#
|
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
|
299
|
+
|
300
|
+
# ==> Devise TwoFactor Extension
|
301
|
+
# Configure OTP extension for devise
|
302
|
+
|
303
|
+
# OTP is mandatory, users are going to be asked to
|
304
|
+
# enroll OTP the next time they sign in, before they can successfully complete the session establishment.
|
305
|
+
# This is the global value, can also be set on each user.
|
306
|
+
#config.otp_mandatory = false
|
307
|
+
|
308
|
+
# Drift: a window which provides allowance for drift between a user's token device clock
|
309
|
+
# (and therefore their OTP tokens) and the authentication server's clock.
|
310
|
+
# Expressed in minutes centered at the current time. (Note: it's a number, *NOT* 3.minutes )
|
311
|
+
#config.otp_drift_window = 3
|
312
|
+
|
313
|
+
# Users that have logged in longer than this time ago, are going to be asked their password
|
314
|
+
# (and an OTP challenge, if enabled) before they can see or change their otp informations.
|
315
|
+
#config.otp_credentials_refresh = 15.minutes
|
316
|
+
|
317
|
+
# Users are given a list of one-time recovery tokens, for emergency access
|
318
|
+
# set to false to disable giving recovery tokens.
|
319
|
+
#config.otp_recovery_tokens = 10
|
320
|
+
|
321
|
+
# The user is allowed to set his browser as "trusted", no more OTP challenges will be
|
322
|
+
# asked for that browser, for a limited time.
|
323
|
+
# set to false to disable setting the browser as trusted
|
324
|
+
#config.otp_trust_persistence = 1.month
|
325
|
+
|
326
|
+
# The name of the token issuer, to be added to the provisioning
|
327
|
+
# url. Display will vary based on token application. (defaults to the Rails application class)
|
328
|
+
config.otp_issuer = 'dummy'
|
251
329
|
end
|