devise_token_auth 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of devise_token_auth might be problematic. Click here for more details.
- checksums.yaml +5 -5
- data/README.md +2 -2
- data/app/controllers/devise_token_auth/application_controller.rb +0 -1
- data/app/controllers/devise_token_auth/concerns/resource_finder.rb +11 -12
- data/app/controllers/devise_token_auth/concerns/set_user_by_token.rb +15 -28
- data/app/controllers/devise_token_auth/confirmations_controller.rb +14 -19
- data/app/controllers/devise_token_auth/omniauth_callbacks_controller.rb +46 -21
- data/app/controllers/devise_token_auth/passwords_controller.rb +15 -19
- data/app/controllers/devise_token_auth/registrations_controller.rb +31 -39
- data/app/controllers/devise_token_auth/unlocks_controller.rb +1 -1
- data/app/models/devise_token_auth/concerns/active_record_support.rb +34 -0
- data/app/models/devise_token_auth/concerns/mongoid_support.rb +19 -0
- data/app/models/devise_token_auth/concerns/user.rb +9 -23
- data/app/models/devise_token_auth/concerns/user_omniauth_callbacks.rb +2 -2
- data/app/validators/{email_validator.rb → devise_token_auth/email_validator.rb} +1 -1
- data/config/locales/he.yml +50 -0
- data/config/locales/ja.yml +1 -1
- data/lib/devise_token_auth.rb +5 -3
- data/lib/devise_token_auth/blacklist.rb +2 -0
- data/lib/devise_token_auth/version.rb +1 -1
- data/lib/generators/devise_token_auth/install_generator.rb +3 -87
- data/lib/generators/devise_token_auth/install_generator_helpers.rb +98 -0
- data/lib/generators/devise_token_auth/install_mongoid_generator.rb +46 -0
- data/lib/generators/devise_token_auth/templates/devise_token_auth_create_users.rb.erb +0 -7
- data/lib/generators/devise_token_auth/templates/user_mongoid.rb.erb +56 -0
- data/test/controllers/custom/custom_confirmations_controller_test.rb +1 -1
- data/test/controllers/devise_token_auth/confirmations_controller_test.rb +41 -20
- data/test/controllers/devise_token_auth/omniauth_callbacks_controller_test.rb +2 -0
- data/test/controllers/devise_token_auth/passwords_controller_test.rb +115 -94
- data/test/controllers/devise_token_auth/registrations_controller_test.rb +31 -4
- data/test/controllers/devise_token_auth/sessions_controller_test.rb +0 -38
- data/test/controllers/devise_token_auth/token_validations_controller_test.rb +2 -1
- data/test/dummy/app/{models → active_record}/lockable_user.rb +0 -0
- data/test/dummy/app/{models → active_record}/mang.rb +0 -0
- data/test/dummy/app/{models → active_record}/only_email_user.rb +0 -0
- data/test/dummy/app/{models → active_record}/scoped_user.rb +2 -2
- data/test/dummy/app/{models → active_record}/unconfirmable_user.rb +1 -2
- data/test/dummy/app/{models → active_record}/unregisterable_user.rb +3 -3
- data/test/dummy/app/active_record/user.rb +6 -0
- data/test/dummy/app/controllers/overrides/sessions_controller.rb +1 -1
- data/test/dummy/app/models/{user.rb → concerns/favorite_color.rb} +7 -8
- data/test/dummy/app/mongoid/lockable_user.rb +38 -0
- data/test/dummy/app/mongoid/mang.rb +46 -0
- data/test/dummy/app/mongoid/only_email_user.rb +33 -0
- data/test/dummy/app/mongoid/scoped_user.rb +50 -0
- data/test/dummy/app/mongoid/unconfirmable_user.rb +44 -0
- data/test/dummy/app/mongoid/unregisterable_user.rb +47 -0
- data/test/dummy/app/mongoid/user.rb +49 -0
- data/test/dummy/config/application.rb +23 -1
- data/test/dummy/config/boot.rb +4 -0
- data/test/dummy/config/initializers/devise.rb +12 -0
- data/test/dummy/db/migrate/20140715061447_devise_token_auth_create_users.rb +0 -7
- data/test/dummy/db/migrate/20140715061805_devise_token_auth_create_mangs.rb +0 -7
- data/test/dummy/db/migrate/20141222035835_devise_token_auth_create_only_email_users.rb +0 -7
- data/test/dummy/db/migrate/20141222053502_devise_token_auth_create_unregisterable_users.rb +0 -7
- data/test/dummy/db/migrate/20150708104536_devise_token_auth_create_unconfirmable_users.rb +0 -7
- data/test/dummy/db/migrate/20160103235141_devise_token_auth_create_scoped_users.rb +0 -7
- data/test/dummy/db/migrate/20160629184441_devise_token_auth_create_lockable_users.rb +0 -7
- data/test/dummy/db/schema.rb +1 -28
- data/test/dummy/tmp/generators/app/models/azpire/v1/human_resource/user.rb +9 -0
- data/test/dummy/tmp/generators/config/initializers/devise_token_auth.rb +50 -0
- data/test/dummy/tmp/generators/config/routes.rb +4 -0
- data/test/dummy/tmp/generators/db/migrate/20190112150327_devise_token_auth_create_azpire_v1_human_resource_users.rb +56 -0
- data/test/lib/devise_token_auth/blacklist_test.rb +11 -0
- data/test/lib/generators/devise_token_auth/install_generator_test.rb +51 -31
- data/test/lib/generators/devise_token_auth/install_generator_with_namespace_test.rb +51 -31
- data/test/models/concerns/mongoid_support_test.rb +31 -0
- data/test/models/only_email_user_test.rb +0 -8
- data/test/models/user_test.rb +1 -1
- data/test/test_helper.rb +12 -2
- metadata +91 -27
- data/config/initializers/devise.rb +0 -198
- data/test/dummy/tmp/generators/app/views/devise/mailer/confirmation_instructions.html.erb +0 -5
- data/test/dummy/tmp/generators/app/views/devise/mailer/reset_password_instructions.html.erb +0 -8
@@ -1,198 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Use this hook to configure devise mailer, warden hooks and so forth.
|
4
|
-
# Many of these configuration options can be set straight in your model.
|
5
|
-
Devise.setup do |config|
|
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
|
-
# config.secret_key = 'd029dbc7262359b4f9906ec029bae825981dee112d9a1425643719765c8fd4884f12a37add35607fa3fa2d6fa6945a0077d7fe0f10a67f8ee66d69e9cc6ac19b'
|
10
|
-
|
11
|
-
# ==> Mailer Configuration
|
12
|
-
# Configure the e-mail address which will be shown in Devise::Mailer,
|
13
|
-
# note that it will be overwritten if you use your own mailer class
|
14
|
-
# with default "from" parameter.
|
15
|
-
config.mailer_sender = 'no-reply@example.com'
|
16
|
-
|
17
|
-
# Configure the class responsible to send e-mails.
|
18
|
-
# config.mailer = 'Devise::Mailer'
|
19
|
-
|
20
|
-
# ==> ORM configuration
|
21
|
-
# Load and configure the ORM. Supports :active_record (default) and
|
22
|
-
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
23
|
-
# available as additional gems.
|
24
|
-
require 'devise/orm/active_record'
|
25
|
-
|
26
|
-
# ==> Configuration for any authentication mechanism
|
27
|
-
# Configure which keys are used when authenticating a user. The default is
|
28
|
-
# just :email. You can configure it to use [:username, :subdomain], so for
|
29
|
-
# authenticating a user, both parameters are required. Remember that those
|
30
|
-
# parameters are used only when authenticating and not when retrieving from
|
31
|
-
# session. If you need permissions, you should implement that in a before filter.
|
32
|
-
# You can also supply a hash where the value is a boolean determining whether
|
33
|
-
# or not authentication should be aborted when the value is not present.
|
34
|
-
# config.authentication_keys = [ :email ]
|
35
|
-
|
36
|
-
# Configure parameters from the request object used for authentication. Each entry
|
37
|
-
# given should be a request method and it will automatically be passed to the
|
38
|
-
# find_for_authentication method and considered in your model lookup. For instance,
|
39
|
-
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
40
|
-
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
41
|
-
# config.request_keys = []
|
42
|
-
|
43
|
-
# Configure which authentication keys should be case-insensitive.
|
44
|
-
# These keys will be downcased upon creating or modifying a user and when used
|
45
|
-
# to authenticate or find a user. Default is :email.
|
46
|
-
config.case_insensitive_keys = [ :email ]
|
47
|
-
|
48
|
-
# Configure which authentication keys should have whitespace stripped.
|
49
|
-
# These keys will have whitespace before and after removed upon creating or
|
50
|
-
# modifying a user and when used to authenticate or find a user. Default is :email.
|
51
|
-
config.strip_whitespace_keys = [ :email ]
|
52
|
-
|
53
|
-
# Tell if authentication through request.params is enabled. True by default.
|
54
|
-
# It can be set to an array that will enable params authentication only for the
|
55
|
-
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
56
|
-
# enable it only for database (email + password) authentication.
|
57
|
-
# config.params_authenticatable = true
|
58
|
-
|
59
|
-
# Tell if authentication through HTTP Auth is enabled. False by default.
|
60
|
-
# It can be set to an array that will enable http authentication only for the
|
61
|
-
# given strategies, for example, `config.http_authenticatable = [:database]` will
|
62
|
-
# enable it only for database authentication. The supported strategies are:
|
63
|
-
# :database = Support basic authentication with authentication key + password
|
64
|
-
# config.http_authenticatable = false
|
65
|
-
|
66
|
-
# If http headers should be returned for AJAX requests. True by default.
|
67
|
-
# config.http_authenticatable_on_xhr = true
|
68
|
-
|
69
|
-
# The realm used in Http Basic Authentication. 'Application' by default.
|
70
|
-
# config.http_authentication_realm = 'Application'
|
71
|
-
|
72
|
-
# It will change confirmation, password recovery and other workflows
|
73
|
-
# to behave the same regardless if the e-mail provided was right or wrong.
|
74
|
-
# Does not affect registerable.
|
75
|
-
# config.paranoid = true
|
76
|
-
|
77
|
-
# By default Devise will store the user in session. You can skip storage for
|
78
|
-
# particular strategies by setting this option.
|
79
|
-
# Notice that if you are skipping storage for all authentication paths, you
|
80
|
-
# may want to disable generating routes to Devise's sessions controller by
|
81
|
-
# passing skip: :sessions to `devise_for` in your config/routes.rb
|
82
|
-
config.skip_session_storage = [:http_auth]
|
83
|
-
|
84
|
-
# By default, Devise cleans up the CSRF token on authentication to
|
85
|
-
# avoid CSRF token fixation attacks. This means that, when using AJAX
|
86
|
-
# requests for sign in and sign up, you need to get a new CSRF token
|
87
|
-
# from the server. You can disable this option at your own risk.
|
88
|
-
# config.clean_up_csrf_token_on_authentication = true
|
89
|
-
|
90
|
-
# ==> Configuration for :database_authenticatable
|
91
|
-
# For bcrypt, this is the cost for hashing the password and defaults to 11. If
|
92
|
-
# using other algorithms, it sets how many times you want the password to be hashed.
|
93
|
-
#
|
94
|
-
# Limiting the stretches to just one in testing will increase the performance of
|
95
|
-
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
96
|
-
# a value less than 10 in other environments. Note that, for bcrypt (the default
|
97
|
-
# algorithm), the cost increases exponentially with the number of stretches (e.g.
|
98
|
-
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
|
99
|
-
config.stretches = Rails.env.test? ? 1 : 11
|
100
|
-
|
101
|
-
# Setup a pepper to generate the encrypted password.
|
102
|
-
# config.pepper = '8ff086600aff82d68ff1e00d23c99c821e66652ec8c2a5b48f58de4a56b325cb532f6db660cf58fc5ecb473b9d851be8cd1badff0a1053bc9dc045f78b6e6772'
|
103
|
-
|
104
|
-
# ==> Configuration for :confirmable
|
105
|
-
# A period that the user is allowed to access the website even without
|
106
|
-
# confirming their account. For instance, if set to 2.days, the user will be
|
107
|
-
# able to access the website for two days without confirming their account,
|
108
|
-
# access will be blocked just in the third day. Default is 0.days, meaning
|
109
|
-
# the user cannot access the website without confirming their account.
|
110
|
-
# config.allow_unconfirmed_access_for = 2.days
|
111
|
-
|
112
|
-
# A period that the user is allowed to confirm their account before their
|
113
|
-
# token becomes invalid. For example, if set to 3.days, the user can confirm
|
114
|
-
# their account within 3 days after the mail was sent, but on the fourth day
|
115
|
-
# their account can't be confirmed with the token any more.
|
116
|
-
# Default is nil, meaning there is no restriction on how long a user can take
|
117
|
-
# before confirming their account.
|
118
|
-
# config.confirm_within = 3.days
|
119
|
-
|
120
|
-
# If true, requires any email changes to be confirmed (exactly the same way as
|
121
|
-
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
122
|
-
# db field (see migrations). Until confirmed, new email is stored in
|
123
|
-
# unconfirmed_email column, and copied to email column on successful confirmation.
|
124
|
-
config.reconfirmable = true
|
125
|
-
|
126
|
-
# Defines which key will be used when confirming an account
|
127
|
-
# config.confirmation_keys = [ :email ]
|
128
|
-
|
129
|
-
# ==> Configuration for :rememberable
|
130
|
-
# The time the user will be remembered without asking for credentials again.
|
131
|
-
# config.remember_for = 2.weeks
|
132
|
-
|
133
|
-
# If true, extends the user's remember period when remembered via cookie.
|
134
|
-
# config.extend_remember_period = false
|
135
|
-
|
136
|
-
# Options to be passed to the created cookie. For instance, you can set
|
137
|
-
# secure: true in order to force SSL only cookies.
|
138
|
-
# config.rememberable_options = {}
|
139
|
-
|
140
|
-
# ==> Configuration for :validatable
|
141
|
-
# Range for password length.
|
142
|
-
config.password_length = 8..128
|
143
|
-
|
144
|
-
# Email regex used to validate email formats. It simply asserts that
|
145
|
-
# one (and only one) @ exists in the given string. This is mainly
|
146
|
-
# to give user feedback and not to assert the e-mail validity.
|
147
|
-
config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
|
148
|
-
|
149
|
-
# ==> Configuration for :timeoutable
|
150
|
-
# The time you want to timeout the user session without activity. After this
|
151
|
-
# time the user will be asked for credentials again. Default is 30 minutes.
|
152
|
-
# config.timeout_in = 30.minutes
|
153
|
-
|
154
|
-
# If true, expires auth token on session timeout.
|
155
|
-
# config.expire_auth_token_on_timeout = false
|
156
|
-
|
157
|
-
# ==> Configuration for :lockable
|
158
|
-
# Defines which strategy will be used to lock an account.
|
159
|
-
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
160
|
-
# :none = No lock strategy. You should handle locking by yourself.
|
161
|
-
# config.lock_strategy = :failed_attempts
|
162
|
-
|
163
|
-
# Defines which key will be used when locking and unlocking an account
|
164
|
-
# config.unlock_keys = [ :email ]
|
165
|
-
|
166
|
-
# Defines which strategy will be used to unlock an account.
|
167
|
-
# :email = Sends an unlock link to the user email
|
168
|
-
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
169
|
-
# :both = Enables both strategies
|
170
|
-
# :none = No unlock strategy. You should handle unlocking by yourself.
|
171
|
-
# config.unlock_strategy = :both
|
172
|
-
|
173
|
-
# Number of authentication tries before locking an account if lock_strategy
|
174
|
-
# is failed attempts.
|
175
|
-
# config.maximum_attempts = 20
|
176
|
-
|
177
|
-
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
178
|
-
# config.unlock_in = 1.hour
|
179
|
-
|
180
|
-
# Warn on the last attempt before the account is locked.
|
181
|
-
# config.last_attempt_warning = false
|
182
|
-
|
183
|
-
# ==> Configuration for :recoverable
|
184
|
-
#
|
185
|
-
# Defines which key will be used when recovering the password for an account
|
186
|
-
# config.reset_password_keys = [ :email ]
|
187
|
-
|
188
|
-
# Time interval you can reset your password with a reset password key.
|
189
|
-
# Don't put a too small interval or your users won't have the time to
|
190
|
-
# change their passwords.
|
191
|
-
config.reset_password_within = 6.hours
|
192
|
-
|
193
|
-
# The default HTTP method used to sign out a resource. Default is :delete.
|
194
|
-
config.sign_out_via = :delete
|
195
|
-
|
196
|
-
# don't serialize tokens
|
197
|
-
Devise::Models::Authenticatable::BLACKLIST_FOR_SERIALIZATION << :tokens
|
198
|
-
end
|
@@ -1,5 +0,0 @@
|
|
1
|
-
<p><%= t(:welcome).capitalize + ' ' + @email %>!</p>
|
2
|
-
|
3
|
-
<p><%= t '.confirm_link_msg' %> </p>
|
4
|
-
|
5
|
-
<p><%= link_to t('.confirm_account_link'), confirmation_url(@resource, {confirmation_token: @token, config: message['client-config'].to_s, redirect_url: message['redirect-url']}).html_safe %></p>
|
@@ -1,8 +0,0 @@
|
|
1
|
-
<p><%= t(:hello).capitalize %> <%= @resource.email %>!</p>
|
2
|
-
|
3
|
-
<p><%= t '.request_reset_link_msg' %></p>
|
4
|
-
|
5
|
-
<p><%= link_to t('.password_change_link'), edit_password_url(@resource, reset_password_token: @token, config: message['client-config'].to_s, redirect_url: message['redirect-url'].to_s).html_safe %></p>
|
6
|
-
|
7
|
-
<p><%= t '.ignore_mail_msg' %></p>
|
8
|
-
<p><%= t '.no_changes_msg' %></p>
|