devise_token_auth 1.1.3 → 1.1.4
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 +4 -4
- data/app/controllers/devise_token_auth/confirmations_controller.rb +1 -0
- data/app/controllers/devise_token_auth/omniauth_callbacks_controller.rb +2 -1
- data/app/models/devise_token_auth/concerns/confirmable_support.rb +27 -0
- data/app/models/devise_token_auth/concerns/user.rb +10 -6
- data/app/models/devise_token_auth/concerns/user_omniauth_callbacks.rb +1 -1
- data/config/locales/ja.yml +1 -1
- data/config/locales/ko.yml +51 -0
- data/config/locales/pl.yml +4 -3
- data/config/locales/pt.yml +4 -3
- data/lib/devise_token_auth/engine.rb +2 -0
- data/lib/devise_token_auth/url.rb +3 -0
- data/lib/devise_token_auth/version.rb +1 -1
- data/lib/generators/devise_token_auth/USAGE +1 -1
- data/lib/generators/devise_token_auth/install_generator.rb +3 -3
- data/lib/generators/devise_token_auth/install_mongoid_generator.rb +2 -2
- data/lib/generators/devise_token_auth/templates/devise_token_auth.rb +5 -0
- data/lib/generators/devise_token_auth/templates/user.rb.erb +2 -2
- data/lib/generators/devise_token_auth/templates/user_mongoid.rb.erb +2 -2
- data/test/controllers/devise_token_auth/confirmations_controller_test.rb +4 -0
- data/test/dummy/app/active_record/confirmable_user.rb +11 -0
- data/test/dummy/app/mongoid/confirmable_user.rb +52 -0
- data/test/dummy/config/initializers/figaro.rb +1 -1
- data/test/dummy/config/initializers/omniauth.rb +1 -0
- data/test/dummy/config/routes.rb +2 -0
- data/test/dummy/{tmp/generators/db/migrate/20170630171909_devise_token_auth_create_mangs.rb → db/migrate/20190924101113_devise_token_auth_create_confirmable_users.rb} +9 -14
- data/test/dummy/db/schema.rb +26 -1
- data/test/dummy/tmp/generators/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/test/dummy/tmp/generators/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/test/factories/users.rb +1 -0
- data/test/lib/devise_token_auth/url_test.rb +2 -2
- data/test/models/confirmable_user_test.rb +35 -0
- data/test/test_helper.rb +1 -1
- metadata +32 -16
- data/test/dummy/tmp/generators/app/models/mang.rb +0 -7
- data/test/dummy/tmp/generators/app/models/user.rb +0 -7
- data/test/dummy/tmp/generators/config/initializers/devise_token_auth.rb +0 -48
- data/test/dummy/tmp/generators/config/routes.rb +0 -9
- data/test/dummy/tmp/generators/db/migrate/20170630171909_devise_token_auth_create_users.rb +0 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 395c104491ef2762e5c41f0b35af5f2421f8d24c99cc10145231d1cb2cab2d70
|
4
|
+
data.tar.gz: c637be9bc9c731f1b6218002925c0e558dbc62f2d6fb999fdd187d31d60e20c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1a184d38110e9157c941f1b5e2b8a0cdd7901702f12c7316a4ffba2b5af239455bddc9c288d8fbbd2c909aadfdfe388283c16abcce1814abf595cfe853e3c51
|
7
|
+
data.tar.gz: 7ac1939d622a50f46e9ce3943826b85e67e9457178bba79326c5656f4c8fbacc5205b44828aa4935be4c2c4dc713f68ab1d44b8d7485ced86fa90416769e1431
|
@@ -112,7 +112,8 @@ module DeviseTokenAuth
|
|
112
112
|
|
113
113
|
# break out provider attribute assignment for easy method extension
|
114
114
|
def assign_provider_attrs(user, auth_hash)
|
115
|
-
attrs = auth_hash['info'].
|
115
|
+
attrs = auth_hash['info'].to_hash
|
116
|
+
attrs = attrs.slice(*user.attribute_names)
|
116
117
|
user.assign_attributes(attrs)
|
117
118
|
end
|
118
119
|
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module DeviseTokenAuth::Concerns::ConfirmableSupport
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
included do
|
5
|
+
# Override standard devise `postpone_email_change?` method
|
6
|
+
# for not to use `will_save_change_to_email?` & `email_changed?` methods.
|
7
|
+
def postpone_email_change?
|
8
|
+
postpone = self.class.reconfirmable &&
|
9
|
+
email_value_in_database != email &&
|
10
|
+
!@bypass_confirmation_postpone &&
|
11
|
+
self.email.present? &&
|
12
|
+
(!@skip_reconfirmation_in_callback || !email_value_in_database.nil?)
|
13
|
+
@bypass_confirmation_postpone = false
|
14
|
+
postpone
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
protected
|
19
|
+
|
20
|
+
def email_value_in_database
|
21
|
+
if Devise.rails51? && respond_to?(:email_in_database)
|
22
|
+
email_in_database
|
23
|
+
else
|
24
|
+
email_was
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -44,6 +44,10 @@ module DeviseTokenAuth::Concerns::User
|
|
44
44
|
def email_changed?; false; end
|
45
45
|
def will_save_change_to_email?; false; end
|
46
46
|
|
47
|
+
if DeviseTokenAuth.send_confirmation_email && devise_modules.include?(:confirmable)
|
48
|
+
include DeviseTokenAuth::Concerns::ConfirmableSupport
|
49
|
+
end
|
50
|
+
|
47
51
|
def password_required?
|
48
52
|
return false unless provider == 'email'
|
49
53
|
super
|
@@ -133,17 +137,17 @@ module DeviseTokenAuth::Concerns::User
|
|
133
137
|
def token_can_be_reused?(token, client)
|
134
138
|
# ghetto HashWithIndifferentAccess
|
135
139
|
updated_at = tokens[client]['updated_at'] || tokens[client][:updated_at]
|
136
|
-
|
140
|
+
last_token_hash = tokens[client]['last_token'] || tokens[client][:last_token]
|
137
141
|
|
138
142
|
return true if (
|
139
143
|
# ensure that the last token and its creation time exist
|
140
|
-
updated_at &&
|
144
|
+
updated_at && last_token_hash &&
|
141
145
|
|
142
146
|
# ensure that previous token falls within the batch buffer throttle time of the last request
|
143
147
|
updated_at.to_time > Time.zone.now - DeviseTokenAuth.batch_request_buffer_throttle &&
|
144
148
|
|
145
149
|
# ensure that the token is valid
|
146
|
-
DeviseTokenAuth::TokenFactory.
|
150
|
+
DeviseTokenAuth::TokenFactory.token_hash_is_token?(last_token_hash, token)
|
147
151
|
)
|
148
152
|
end
|
149
153
|
|
@@ -154,7 +158,7 @@ module DeviseTokenAuth::Concerns::User
|
|
154
158
|
token = create_token(
|
155
159
|
client: client,
|
156
160
|
last_token: tokens.fetch(client, {})['token'],
|
157
|
-
updated_at: now
|
161
|
+
updated_at: now.to_s(:rfc822)
|
158
162
|
)
|
159
163
|
|
160
164
|
update_auth_header(token.token, token.client)
|
@@ -190,7 +194,7 @@ module DeviseTokenAuth::Concerns::User
|
|
190
194
|
end
|
191
195
|
|
192
196
|
def extend_batch_buffer(token, client)
|
193
|
-
tokens[client]['updated_at'] = Time.zone.now
|
197
|
+
tokens[client]['updated_at'] = Time.zone.now.to_s(:rfc822)
|
194
198
|
update_auth_header(token, client)
|
195
199
|
end
|
196
200
|
|
@@ -214,7 +218,7 @@ module DeviseTokenAuth::Concerns::User
|
|
214
218
|
end
|
215
219
|
|
216
220
|
def should_remove_tokens_after_password_reset?
|
217
|
-
if Rails::VERSION::MAJOR <= 5
|
221
|
+
if Rails::VERSION::MAJOR <= 5 ||defined?('Mongoid')
|
218
222
|
encrypted_password_changed? &&
|
219
223
|
DeviseTokenAuth.remove_tokens_after_password_reset
|
220
224
|
else
|
@@ -9,7 +9,7 @@ module DeviseTokenAuth::Concerns::UserOmniauthCallbacks
|
|
9
9
|
validates_presence_of :uid, unless: :email_provider?
|
10
10
|
|
11
11
|
# only validate unique emails among email registration users
|
12
|
-
validates :email, uniqueness: { scope: :provider }, on: :create, if: :email_provider?
|
12
|
+
validates :email, uniqueness: { case_sensitive: false, scope: :provider }, on: :create, if: :email_provider?
|
13
13
|
|
14
14
|
# keep uid in sync with email
|
15
15
|
before_save :sync_uid
|
data/config/locales/ja.yml
CHANGED
@@ -29,7 +29,7 @@ ja:
|
|
29
29
|
messages:
|
30
30
|
validate_sign_up_params: "リクエストボディに適切なアカウント新規登録データを送信してください。"
|
31
31
|
validate_account_update_params: "リクエストボディに適切なアカウント更新のデータを送信してください。"
|
32
|
-
not_email: "
|
32
|
+
not_email: "は有効ではありません"
|
33
33
|
devise:
|
34
34
|
mailer:
|
35
35
|
confirmation_instructions:
|
@@ -0,0 +1,51 @@
|
|
1
|
+
ko:
|
2
|
+
devise_token_auth:
|
3
|
+
sessions:
|
4
|
+
not_confirmed: "'%{email}'로 주소 인증 메일을 발송했습니다. 계정을 활성화하기 위해서는 반드시 메일의 안내를 따라야 합니다."
|
5
|
+
bad_credentials: "계정 정보가 맞지 않습니다. 다시 시도해 주세요."
|
6
|
+
not_supported: "POST /sign_in to sign in을 사용해주세요. GET은 지원하지 않습니다."
|
7
|
+
user_not_found: "유저를 찾을 수 없습니다."
|
8
|
+
invalid: "계정 정보가 맞지 않습니다."
|
9
|
+
registrations:
|
10
|
+
missing_confirm_success_url: "'confirm_success_url' 파라미터가 없습니다."
|
11
|
+
redirect_url_not_allowed: "'%{redirect_url}' 주소로 리다이렉트는 허용하지 않습니다."
|
12
|
+
email_already_exists: "'%{email}'을 사용하는 계정이 이미 있습니다."
|
13
|
+
account_with_uid_destroyed: " UID가 '%{uid}'인 계정을 삭제했습니다."
|
14
|
+
account_to_destroy_not_found: "삭제할 계정을 찾을 수 없습니다."
|
15
|
+
user_not_found: "유저를 찾을 수 없습니다."
|
16
|
+
omniauth:
|
17
|
+
not_allowed_redirect_url: "'%{redirect_url}' 주소로 리다이렉트는 허용하지 않습니다."
|
18
|
+
passwords:
|
19
|
+
missing_email: "이메일 주소를 입력해야 합니다."
|
20
|
+
missing_redirect_url: "redirect URL이 없습니다."
|
21
|
+
not_allowed_redirect_url: "'%{redirect_url}' 주소로 리다이렉트는 허용하지 않습니다."
|
22
|
+
sended: "'%{email}'로 비밀번호를 재설정하기 위한 안내 메일을 발송했습니다."
|
23
|
+
user_not_found: "'%{email}'을 사용하는 유저를 찾을 수 없습니다."
|
24
|
+
password_not_required: "이 계정은 비밀번호가 필요하지 않습니다. '%{provider}'으로 로그인을 진행해 주세요."
|
25
|
+
missing_passwords: "비밀번호와 비밀번호 확인 필드를 반드시 입력해야 합니다."
|
26
|
+
successfully_updated: "비밀번호를 성공적으로 업데이트 했습니다."
|
27
|
+
unlocks:
|
28
|
+
missing_email: "이메일 주소를 반드시 입력해야 합니다."
|
29
|
+
sended: "'%{email}'로 계정 잠금 해제를 위한 안내 메일을 발송했습니다."
|
30
|
+
user_not_found: "'%{email}'을 사용하는 유저를 찾을 수 없습니다."
|
31
|
+
errors:
|
32
|
+
messages:
|
33
|
+
validate_sign_up_params: "요청 값에 알맞은 로그인 데이터를 입력하세요."
|
34
|
+
validate_account_update_params: "요청 값에 알맞은 업데이트 데이터를 입력하세요."
|
35
|
+
not_email: "이메일이 아닙니다."
|
36
|
+
devise:
|
37
|
+
mailer:
|
38
|
+
confirmation_instructions:
|
39
|
+
confirm_link_msg: "아래의 링크를 이용해 계정 인증을 할 수 있습니다."
|
40
|
+
confirm_account_link: "본인 계정 인증"
|
41
|
+
reset_password_instructions:
|
42
|
+
request_reset_link_msg: "누군가 당신의 비밀번호를 변경하는 링크를 요청했으며, 다음의 링크에서 비밀번호 변경이 가능합니다."
|
43
|
+
password_change_link: "비밀번호 변경"
|
44
|
+
ignore_mail_msg: "비밀번호 변경을 요청하지 않으셨다면 이 메일을 무시하십시오."
|
45
|
+
no_changes_msg: "위 링크에 접속하여 새로운 비밀번호를 생성하기 전까지 귀하의 비밀번호는 변경되지 않습니다."
|
46
|
+
unlock_instructions:
|
47
|
+
account_lock_msg: "로그인 실패 횟수 초과로 귀하의 계정이 잠금 처리되었습니다."
|
48
|
+
unlock_link_msg: "계정 잠금을 해제하려면 아래 링크를 클릭하세요."
|
49
|
+
unlock_link: "계정 잠금 해제"
|
50
|
+
hello: "안녕하세요"
|
51
|
+
welcome: "환영합니다"
|
data/config/locales/pl.yml
CHANGED
@@ -26,9 +26,10 @@ pl:
|
|
26
26
|
missing_passwords: "Musisz wypełnić wszystkie pola z etykietą 'Hasło' oraz 'Potwierdzenie hasła'."
|
27
27
|
successfully_updated: "Twoje hasło zostało zaktualizowane."
|
28
28
|
errors:
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
messages:
|
30
|
+
validate_sign_up_params: "Proszę dostarczyć odpowiednie dane logowania w ciele zapytania."
|
31
|
+
validate_account_update_params: "Proszę dostarczyć odpowiednie dane aktualizacji konta w ciele zapytania."
|
32
|
+
not_email: "nie jest prawidłowym adresem e-mail"
|
32
33
|
devise:
|
33
34
|
mailer:
|
34
35
|
confirmation_instructions:
|
data/config/locales/pt.yml
CHANGED
@@ -26,9 +26,10 @@ pt:
|
|
26
26
|
missing_passwords: "Preencha a senha e a confirmação de senha."
|
27
27
|
successfully_updated: "Senha atualizada com sucesso."
|
28
28
|
errors:
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
messages:
|
30
|
+
validate_sign_up_params: "Os dados submetidos na requisição de registo são inválidos."
|
31
|
+
validate_account_update_params: "Os dados submetidos para atualização de conta são inválidos."
|
32
|
+
not_email: "não é um e-mail"
|
32
33
|
devise:
|
33
34
|
mailer:
|
34
35
|
confirmation_instructions:
|
@@ -26,6 +26,7 @@ module DeviseTokenAuth
|
|
26
26
|
:default_callbacks,
|
27
27
|
:headers_names,
|
28
28
|
:bypass_sign_in,
|
29
|
+
:send_confirmation_email,
|
29
30
|
:require_client_password_reset_token
|
30
31
|
|
31
32
|
self.change_headers_on_each_request = true
|
@@ -47,6 +48,7 @@ module DeviseTokenAuth
|
|
47
48
|
'uid': 'uid',
|
48
49
|
'token-type': 'token-type' }
|
49
50
|
self.bypass_sign_in = true
|
51
|
+
self.send_confirmation_email = false
|
50
52
|
self.require_client_password_reset_token = false
|
51
53
|
|
52
54
|
def self.setup(&block)
|
@@ -11,6 +11,9 @@ module DeviseTokenAuth::Url
|
|
11
11
|
query = [uri.query, params.to_query].reject(&:blank?).join('&')
|
12
12
|
res += "?#{query}"
|
13
13
|
res += "##{uri.fragment}" if uri.fragment
|
14
|
+
# repeat any query params after the fragment to deal with Angular eating any pre fragment query params, used
|
15
|
+
# in the reset password redirect url
|
16
|
+
res += "?#{query}" if uri.fragment
|
14
17
|
|
15
18
|
res
|
16
19
|
end
|
@@ -8,7 +8,7 @@ Arguments:
|
|
8
8
|
# 'User'
|
9
9
|
MOUNT_PATH # The path at which to mount the authentication routes. Default is
|
10
10
|
# 'auth'. More detail documentation is here:
|
11
|
-
# https://
|
11
|
+
# https://devise-token-auth.gitbook.io/devise-token-auth/usage
|
12
12
|
|
13
13
|
Example:
|
14
14
|
rails generate devise_token_auth:install User auth
|
@@ -75,12 +75,12 @@ module DeviseTokenAuth
|
|
75
75
|
ActiveRecord::Base.connection.select_value('SELECT VERSION()')
|
76
76
|
end
|
77
77
|
|
78
|
-
def
|
79
|
-
Rails
|
78
|
+
def rails_5_or_newer?
|
79
|
+
Rails::VERSION::MAJOR >= 5
|
80
80
|
end
|
81
81
|
|
82
82
|
def primary_key_type
|
83
|
-
primary_key_string if
|
83
|
+
primary_key_string if rails_5_or_newer?
|
84
84
|
end
|
85
85
|
|
86
86
|
def primary_key_string
|
@@ -29,9 +29,9 @@ module DeviseTokenAuth
|
|
29
29
|
field :tokens, type: Hash, default: {}
|
30
30
|
|
31
31
|
# Include default devise modules. Others available are:
|
32
|
-
# :confirmable, :lockable, :timeoutable and :omniauthable
|
32
|
+
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
33
33
|
devise :database_authenticatable, :registerable,
|
34
|
-
:recoverable, :rememberable, :
|
34
|
+
:recoverable, :rememberable, :validatable
|
35
35
|
include DeviseTokenAuth::Concerns::User
|
36
36
|
|
37
37
|
index({ uid: 1, provider: 1}, { name: 'uid_provider_index', unique: true, background: true })
|
@@ -52,4 +52,9 @@ DeviseTokenAuth.setup do |config|
|
|
52
52
|
# If, however, you wish to integrate with legacy Devise authentication, you can
|
53
53
|
# do so by enabling this flag. NOTE: This feature is highly experimental!
|
54
54
|
# config.enable_standard_devise_support = false
|
55
|
+
|
56
|
+
# By default DeviseTokenAuth will not send confirmation email, even when including
|
57
|
+
# devise confirmable module. If you want to use devise confirmable module and
|
58
|
+
# send email, set it to true. (This is a setting for compatibility)
|
59
|
+
# config.send_confirmation_email = true
|
55
60
|
end
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
class <%= user_class %> < ActiveRecord::Base
|
4
4
|
# Include default devise modules. Others available are:
|
5
|
-
# :confirmable, :lockable, :timeoutable and :omniauthable
|
5
|
+
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
6
6
|
devise :database_authenticatable, :registerable,
|
7
|
-
:recoverable, :rememberable, :
|
7
|
+
:recoverable, :rememberable, :validatable
|
8
8
|
include DeviseTokenAuth::Concerns::User
|
9
9
|
end
|
@@ -43,9 +43,9 @@ class <%= user_class %>
|
|
43
43
|
field :tokens, type: Hash, default: {}
|
44
44
|
|
45
45
|
# Include default devise modules. Others available are:
|
46
|
-
# :confirmable, :lockable, :timeoutable and :omniauthable
|
46
|
+
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
47
47
|
devise :database_authenticatable, :registerable,
|
48
|
-
:recoverable, :rememberable, :
|
48
|
+
:recoverable, :rememberable, :validatable
|
49
49
|
include DeviseTokenAuth::Concerns::User
|
50
50
|
|
51
51
|
index({ email: 1 }, { name: 'email_index', unique: true, background: true })
|
@@ -53,6 +53,10 @@ class DeviseTokenAuth::ConfirmationsControllerTest < ActionController::TestCase
|
|
53
53
|
assert @resource.confirmed?
|
54
54
|
end
|
55
55
|
|
56
|
+
test 'should save the authentication token' do
|
57
|
+
assert @resource.reload.tokens.present?
|
58
|
+
end
|
59
|
+
|
56
60
|
test 'should redirect to success url' do
|
57
61
|
assert_redirected_to(/^#{@redirect_url}/)
|
58
62
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class ConfirmableUser < ActiveRecord::Base
|
4
|
+
# Include default devise modules.
|
5
|
+
devise :database_authenticatable, :registerable,
|
6
|
+
:recoverable, :rememberable,
|
7
|
+
:validatable, :confirmable
|
8
|
+
DeviseTokenAuth.send_confirmation_email = true
|
9
|
+
include DeviseTokenAuth::Concerns::User
|
10
|
+
DeviseTokenAuth.send_confirmation_email = false
|
11
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class ConfirmableUser
|
4
|
+
include Mongoid::Document
|
5
|
+
include Mongoid::Timestamps
|
6
|
+
include Mongoid::Locker
|
7
|
+
|
8
|
+
field :locker_locked_at, type: Time
|
9
|
+
field :locker_locked_until, type: Time
|
10
|
+
|
11
|
+
locker locked_at_field: :locker_locked_at,
|
12
|
+
locked_until_field: :locker_locked_until
|
13
|
+
|
14
|
+
## User Info
|
15
|
+
field :name, type: String
|
16
|
+
field :nickname, type: String
|
17
|
+
field :image, type: String
|
18
|
+
|
19
|
+
## Database authenticatable
|
20
|
+
field :email, type: String, default: ''
|
21
|
+
field :encrypted_password, type: String, default: ''
|
22
|
+
|
23
|
+
## Recoverable
|
24
|
+
field :reset_password_token, type: String
|
25
|
+
field :reset_password_sent_at, type: Time
|
26
|
+
field :reset_password_redirect_url, type: String
|
27
|
+
field :allow_password_change, type: Boolean, default: false
|
28
|
+
|
29
|
+
## Rememberable
|
30
|
+
field :remember_created_at, type: Time
|
31
|
+
|
32
|
+
## Confirmable
|
33
|
+
field :confirmation_token, type: String
|
34
|
+
field :confirmed_at, type: Time
|
35
|
+
field :confirmation_sent_at, type: Time
|
36
|
+
field :unconfirmed_email, type: String # Only if using reconfirmable
|
37
|
+
|
38
|
+
## Required
|
39
|
+
field :provider, type: String
|
40
|
+
field :uid, type: String, default: ''
|
41
|
+
|
42
|
+
## Tokens
|
43
|
+
field :tokens, type: Hash, default: {}
|
44
|
+
|
45
|
+
# Include default devise modules.
|
46
|
+
devise :database_authenticatable, :registerable,
|
47
|
+
:recoverable, :rememberable, :trackable,
|
48
|
+
:validatable, :confirmable
|
49
|
+
DeviseTokenAuth.send_confirmation_email = true
|
50
|
+
include DeviseTokenAuth::Concerns::User
|
51
|
+
DeviseTokenAuth.send_confirmation_email = false
|
52
|
+
end
|
@@ -1,3 +1,3 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
#Figaro.require("GITHUB_KEY", "GITHUB_SECRET", "FACEBOOK_KEY", "FACEBOOK_SECRET", "GOOGLE_KEY", "GOOGLE_SECRET")
|
3
|
+
#Figaro.require("GITHUB_KEY", "GITHUB_SECRET", "FACEBOOK_KEY", "FACEBOOK_SECRET", "GOOGLE_KEY", "GOOGLE_SECRET", "APPLE_CLIENT_ID", "APPLE_TEAM_ID", "APPLE_KEY", "APPLE_PEM")
|
@@ -4,6 +4,7 @@ Rails.application.config.middleware.use OmniAuth::Builder do |b|
|
|
4
4
|
provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET'], scope: 'email,profile'
|
5
5
|
provider :facebook, ENV['FACEBOOK_KEY'], ENV['FACEBOOK_SECRET']
|
6
6
|
provider :google_oauth2, ENV['GOOGLE_KEY'], ENV['GOOGLE_SECRET']
|
7
|
+
provider :apple, ENV['APPLE_CLIENT_ID'], '', { scope: 'email name', team_id: ENV['APPLE_TEAM_ID'], key_id: ENV['APPLE_KEY'], pem: ENV['APPLE_PEM'] }
|
7
8
|
provider :developer,
|
8
9
|
fields: [:first_name, :last_name],
|
9
10
|
uid_field: :last_name
|
data/test/dummy/config/routes.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
class
|
1
|
+
class DeviseTokenAuthCreateConfirmableUsers < ActiveRecord::Migration[5.2]
|
2
2
|
def change
|
3
|
-
|
3
|
+
|
4
|
+
create_table(:confirmable_users) do |t|
|
4
5
|
## Required
|
5
6
|
t.string :provider, :null => false, :default => "email"
|
6
7
|
t.string :uid, :null => false, :default => ""
|
@@ -11,17 +12,11 @@ class DeviseTokenAuthCreateMangs < ActiveRecord::Migration[4.2]
|
|
11
12
|
## Recoverable
|
12
13
|
t.string :reset_password_token
|
13
14
|
t.datetime :reset_password_sent_at
|
15
|
+
t.boolean :allow_password_change, :default => false
|
14
16
|
|
15
17
|
## Rememberable
|
16
18
|
t.datetime :remember_created_at
|
17
19
|
|
18
|
-
## Trackable
|
19
|
-
t.integer :sign_in_count, :default => 0, :null => false
|
20
|
-
t.datetime :current_sign_in_at
|
21
|
-
t.datetime :last_sign_in_at
|
22
|
-
t.string :current_sign_in_ip
|
23
|
-
t.string :last_sign_in_ip
|
24
|
-
|
25
20
|
## Confirmable
|
26
21
|
t.string :confirmation_token
|
27
22
|
t.datetime :confirmed_at
|
@@ -45,10 +40,10 @@ class DeviseTokenAuthCreateMangs < ActiveRecord::Migration[4.2]
|
|
45
40
|
t.timestamps
|
46
41
|
end
|
47
42
|
|
48
|
-
add_index :
|
49
|
-
add_index :
|
50
|
-
add_index :
|
51
|
-
add_index :
|
52
|
-
# add_index :
|
43
|
+
add_index :confirmable_users, :email, unique: true
|
44
|
+
add_index :confirmable_users, [:uid, :provider], unique: true
|
45
|
+
add_index :confirmable_users, :reset_password_token, unique: true
|
46
|
+
add_index :confirmable_users, :confirmation_token, unique: true
|
47
|
+
# add_index :confirmable_users, :unlock_token, unique: true
|
53
48
|
end
|
54
49
|
end
|
data/test/dummy/db/schema.rb
CHANGED
@@ -10,7 +10,32 @@
|
|
10
10
|
#
|
11
11
|
# It's strongly recommended that you check this file into your version control system.
|
12
12
|
|
13
|
-
ActiveRecord::Schema.define(version:
|
13
|
+
ActiveRecord::Schema.define(version: 2019_09_24_101113) do
|
14
|
+
|
15
|
+
create_table "confirmable_users", force: :cascade do |t|
|
16
|
+
t.string "provider", default: "email", null: false
|
17
|
+
t.string "uid", default: "", null: false
|
18
|
+
t.string "encrypted_password", default: "", null: false
|
19
|
+
t.string "reset_password_token"
|
20
|
+
t.datetime "reset_password_sent_at"
|
21
|
+
t.boolean "allow_password_change", default: false
|
22
|
+
t.datetime "remember_created_at"
|
23
|
+
t.string "confirmation_token"
|
24
|
+
t.datetime "confirmed_at"
|
25
|
+
t.datetime "confirmation_sent_at"
|
26
|
+
t.string "unconfirmed_email"
|
27
|
+
t.string "name"
|
28
|
+
t.string "nickname"
|
29
|
+
t.string "image"
|
30
|
+
t.string "email"
|
31
|
+
t.text "tokens"
|
32
|
+
t.datetime "created_at", null: false
|
33
|
+
t.datetime "updated_at", null: false
|
34
|
+
t.index ["confirmation_token"], name: "index_confirmable_users_on_confirmation_token", unique: true
|
35
|
+
t.index ["email"], name: "index_confirmable_users_on_email", unique: true
|
36
|
+
t.index ["reset_password_token"], name: "index_confirmable_users_on_reset_password_token", unique: true
|
37
|
+
t.index ["uid", "provider"], name: "index_confirmable_users_on_uid_and_provider", unique: true
|
38
|
+
end
|
14
39
|
|
15
40
|
create_table "lockable_users", force: :cascade do |t|
|
16
41
|
t.string "provider", null: false
|
@@ -0,0 +1,5 @@
|
|
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>
|
@@ -0,0 +1,8 @@
|
|
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>
|
data/test/factories/users.rb
CHANGED
@@ -4,10 +4,10 @@ require 'test_helper'
|
|
4
4
|
|
5
5
|
class DeviseTokenAuth::UrlTest < ActiveSupport::TestCase
|
6
6
|
describe 'DeviseTokenAuth::Url#generate' do
|
7
|
-
test 'URI fragment should appear at the end of URL' do
|
7
|
+
test 'URI fragment should appear at the end of URL with repeat of query params' do
|
8
8
|
params = { client_id: 123 }
|
9
9
|
url = 'http://example.com#fragment'
|
10
|
-
assert_equal DeviseTokenAuth::Url.send(:generate, url, params), 'http://example.com?client_id=123#fragment'
|
10
|
+
assert_equal DeviseTokenAuth::Url.send(:generate, url, params), 'http://example.com?client_id=123#fragment?client_id=123'
|
11
11
|
end
|
12
12
|
|
13
13
|
describe 'with existing query params' do
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
class ConfirmableUserTest < ActiveSupport::TestCase
|
6
|
+
describe ConfirmableUser do
|
7
|
+
describe 'creation' do
|
8
|
+
test 'email should be saved' do
|
9
|
+
@resource = create(:confirmable_user)
|
10
|
+
assert @resource.email.present?
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'updating email' do
|
15
|
+
test 'new email should be saved to unconfirmed_email' do
|
16
|
+
@resource = create(:confirmable_user, email: 'old_address@example.com')
|
17
|
+
@resource.update(email: 'new_address@example.com')
|
18
|
+
assert @resource.unconfirmed_email == 'new_address@example.com'
|
19
|
+
end
|
20
|
+
|
21
|
+
test 'old email should be kept in email' do
|
22
|
+
@resource = create(:confirmable_user, email: 'old_address@example.com')
|
23
|
+
@resource.update(email: 'new_address@example.com')
|
24
|
+
assert @resource.email == 'old_address@example.com'
|
25
|
+
end
|
26
|
+
|
27
|
+
test 'confirmation_token should be changed' do
|
28
|
+
@resource = create(:confirmable_user, email: 'old_address@example.com')
|
29
|
+
old_token = @resource.confirmation_token
|
30
|
+
@resource.update(email: 'new_address@example.com')
|
31
|
+
assert @resource.confirmation_token != old_token
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -46,7 +46,7 @@ class ActiveSupport::TestCase
|
|
46
46
|
|
47
47
|
def age_token(user, client_id)
|
48
48
|
if user.tokens[client_id]
|
49
|
-
user.tokens[client_id]['updated_at'] = Time.zone.now - (DeviseTokenAuth.batch_request_buffer_throttle + 10.seconds)
|
49
|
+
user.tokens[client_id]['updated_at'] = (Time.zone.now - (DeviseTokenAuth.batch_request_buffer_throttle + 10.seconds)).to_s(:rfc822)
|
50
50
|
user.save!
|
51
51
|
end
|
52
52
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_token_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lynn Hurley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -30,6 +30,20 @@ dependencies:
|
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '6.1'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: sprockets
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - '='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 3.7.2
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - '='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 3.7.2
|
33
47
|
- !ruby/object:Gem::Dependency
|
34
48
|
name: devise
|
35
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,14 +98,14 @@ dependencies:
|
|
84
98
|
requirements:
|
85
99
|
- - "~>"
|
86
100
|
- !ruby/object:Gem::Version
|
87
|
-
version: 1.
|
101
|
+
version: '1.4'
|
88
102
|
type: :development
|
89
103
|
prerelease: false
|
90
104
|
version_requirements: !ruby/object:Gem::Requirement
|
91
105
|
requirements:
|
92
106
|
- - "~>"
|
93
107
|
- !ruby/object:Gem::Version
|
94
|
-
version: 1.
|
108
|
+
version: '1.4'
|
95
109
|
- !ruby/object:Gem::Dependency
|
96
110
|
name: pg
|
97
111
|
requirement: !ruby/object:Gem::Requirement
|
@@ -175,6 +189,7 @@ files:
|
|
175
189
|
- app/controllers/devise_token_auth/token_validations_controller.rb
|
176
190
|
- app/controllers/devise_token_auth/unlocks_controller.rb
|
177
191
|
- app/models/devise_token_auth/concerns/active_record_support.rb
|
192
|
+
- app/models/devise_token_auth/concerns/confirmable_support.rb
|
178
193
|
- app/models/devise_token_auth/concerns/mongoid_support.rb
|
179
194
|
- app/models/devise_token_auth/concerns/tokens_serialization.rb
|
180
195
|
- app/models/devise_token_auth/concerns/user.rb
|
@@ -192,6 +207,7 @@ files:
|
|
192
207
|
- config/locales/he.yml
|
193
208
|
- config/locales/it.yml
|
194
209
|
- config/locales/ja.yml
|
210
|
+
- config/locales/ko.yml
|
195
211
|
- config/locales/nl.yml
|
196
212
|
- config/locales/pl.yml
|
197
213
|
- config/locales/pt-BR.yml
|
@@ -248,6 +264,7 @@ files:
|
|
248
264
|
- test/controllers/overrides/sessions_controller_test.rb
|
249
265
|
- test/controllers/overrides/token_validations_controller_test.rb
|
250
266
|
- test/dummy/README.rdoc
|
267
|
+
- test/dummy/app/active_record/confirmable_user.rb
|
251
268
|
- test/dummy/app/active_record/lockable_user.rb
|
252
269
|
- test/dummy/app/active_record/mang.rb
|
253
270
|
- test/dummy/app/active_record/only_email_user.rb
|
@@ -274,6 +291,7 @@ files:
|
|
274
291
|
- test/dummy/app/controllers/overrides/token_validations_controller.rb
|
275
292
|
- test/dummy/app/helpers/application_helper.rb
|
276
293
|
- test/dummy/app/models/concerns/favorite_color.rb
|
294
|
+
- test/dummy/app/mongoid/confirmable_user.rb
|
277
295
|
- test/dummy/app/mongoid/lockable_user.rb
|
278
296
|
- test/dummy/app/mongoid/mang.rb
|
279
297
|
- test/dummy/app/mongoid/only_email_user.rb
|
@@ -313,14 +331,11 @@ files:
|
|
313
331
|
- test/dummy/db/migrate/20150708104536_devise_token_auth_create_unconfirmable_users.rb
|
314
332
|
- test/dummy/db/migrate/20160103235141_devise_token_auth_create_scoped_users.rb
|
315
333
|
- test/dummy/db/migrate/20160629184441_devise_token_auth_create_lockable_users.rb
|
334
|
+
- test/dummy/db/migrate/20190924101113_devise_token_auth_create_confirmable_users.rb
|
316
335
|
- test/dummy/db/schema.rb
|
317
336
|
- test/dummy/lib/migration_database_helper.rb
|
318
|
-
- test/dummy/tmp/generators/app/
|
319
|
-
- test/dummy/tmp/generators/app/
|
320
|
-
- test/dummy/tmp/generators/config/initializers/devise_token_auth.rb
|
321
|
-
- test/dummy/tmp/generators/config/routes.rb
|
322
|
-
- test/dummy/tmp/generators/db/migrate/20170630171909_devise_token_auth_create_mangs.rb
|
323
|
-
- test/dummy/tmp/generators/db/migrate/20170630171909_devise_token_auth_create_users.rb
|
337
|
+
- test/dummy/tmp/generators/app/views/devise/mailer/confirmation_instructions.html.erb
|
338
|
+
- test/dummy/tmp/generators/app/views/devise/mailer/reset_password_instructions.html.erb
|
324
339
|
- test/factories/users.rb
|
325
340
|
- test/lib/devise_token_auth/blacklist_test.rb
|
326
341
|
- test/lib/devise_token_auth/token_factory_test.rb
|
@@ -330,6 +345,7 @@ files:
|
|
330
345
|
- test/lib/generators/devise_token_auth/install_views_generator_test.rb
|
331
346
|
- test/models/concerns/mongoid_support_test.rb
|
332
347
|
- test/models/concerns/tokens_serialization_test.rb
|
348
|
+
- test/models/confirmable_user_test.rb
|
333
349
|
- test/models/only_email_user_test.rb
|
334
350
|
- test/models/user_test.rb
|
335
351
|
- test/support/controllers/routes.rb
|
@@ -360,6 +376,7 @@ summary: Token based authentication for rails. Uses Devise + OmniAuth.
|
|
360
376
|
test_files:
|
361
377
|
- test/dummy/app/mongoid/only_email_user.rb
|
362
378
|
- test/dummy/app/mongoid/scoped_user.rb
|
379
|
+
- test/dummy/app/mongoid/confirmable_user.rb
|
363
380
|
- test/dummy/app/mongoid/mang.rb
|
364
381
|
- test/dummy/app/mongoid/unregisterable_user.rb
|
365
382
|
- test/dummy/app/mongoid/lockable_user.rb
|
@@ -368,6 +385,7 @@ test_files:
|
|
368
385
|
- test/dummy/app/models/concerns/favorite_color.rb
|
369
386
|
- test/dummy/app/active_record/only_email_user.rb
|
370
387
|
- test/dummy/app/active_record/scoped_user.rb
|
388
|
+
- test/dummy/app/active_record/confirmable_user.rb
|
371
389
|
- test/dummy/app/active_record/mang.rb
|
372
390
|
- test/dummy/app/active_record/unregisterable_user.rb
|
373
391
|
- test/dummy/app/active_record/lockable_user.rb
|
@@ -425,14 +443,12 @@ test_files:
|
|
425
443
|
- test/dummy/db/migrate/20160103235141_devise_token_auth_create_scoped_users.rb
|
426
444
|
- test/dummy/db/migrate/20140715061447_devise_token_auth_create_users.rb
|
427
445
|
- test/dummy/db/migrate/20140715061805_devise_token_auth_create_mangs.rb
|
428
|
-
- test/dummy/
|
429
|
-
- test/dummy/tmp/generators/app/
|
430
|
-
- test/dummy/tmp/generators/
|
431
|
-
- test/dummy/tmp/generators/config/initializers/devise_token_auth.rb
|
432
|
-
- test/dummy/tmp/generators/db/migrate/20170630171909_devise_token_auth_create_mangs.rb
|
433
|
-
- test/dummy/tmp/generators/db/migrate/20170630171909_devise_token_auth_create_users.rb
|
446
|
+
- test/dummy/db/migrate/20190924101113_devise_token_auth_create_confirmable_users.rb
|
447
|
+
- test/dummy/tmp/generators/app/views/devise/mailer/confirmation_instructions.html.erb
|
448
|
+
- test/dummy/tmp/generators/app/views/devise/mailer/reset_password_instructions.html.erb
|
434
449
|
- test/dummy/README.rdoc
|
435
450
|
- test/models/only_email_user_test.rb
|
451
|
+
- test/models/confirmable_user_test.rb
|
436
452
|
- test/models/concerns/mongoid_support_test.rb
|
437
453
|
- test/models/concerns/tokens_serialization_test.rb
|
438
454
|
- test/models/user_test.rb
|
@@ -1,48 +0,0 @@
|
|
1
|
-
DeviseTokenAuth.setup do |config|
|
2
|
-
# By default the authorization headers will change after each request. The
|
3
|
-
# client is responsible for keeping track of the changing tokens. Change
|
4
|
-
# this to false to prevent the Authorization header from changing after
|
5
|
-
# each request.
|
6
|
-
# config.change_headers_on_each_request = true
|
7
|
-
|
8
|
-
# By default, users will need to re-authenticate after 2 weeks. This setting
|
9
|
-
# determines how long tokens will remain valid after they are issued.
|
10
|
-
# config.token_lifespan = 2.weeks
|
11
|
-
|
12
|
-
# Sets the max number of concurrent devices per user, which is 10 by default.
|
13
|
-
# After this limit is reached, the oldest tokens will be removed.
|
14
|
-
# config.max_number_of_devices = 10
|
15
|
-
|
16
|
-
# Sometimes it's necessary to make several requests to the API at the same
|
17
|
-
# time. In this case, each request in the batch will need to share the same
|
18
|
-
# auth token. This setting determines how far apart the requests can be while
|
19
|
-
# still using the same auth token.
|
20
|
-
# config.batch_request_buffer_throttle = 5.seconds
|
21
|
-
|
22
|
-
# This route will be the prefix for all oauth2 redirect callbacks. For
|
23
|
-
# example, using the default '/omniauth', the github oauth2 provider will
|
24
|
-
# redirect successful authentications to '/omniauth/github/callback'
|
25
|
-
# config.omniauth_prefix = "/omniauth"
|
26
|
-
|
27
|
-
# By default sending current password is not needed for the password update.
|
28
|
-
# Uncomment to enforce current_password param to be checked before all
|
29
|
-
# attribute updates. Set it to :password if you want it to be checked only if
|
30
|
-
# password is updated.
|
31
|
-
# config.check_current_password_before_update = :attributes
|
32
|
-
|
33
|
-
# By default we will use callbacks for single omniauth.
|
34
|
-
# It depends on fields like email, provider and uid.
|
35
|
-
# config.default_callbacks = true
|
36
|
-
|
37
|
-
# Makes it possible to change the headers names
|
38
|
-
# config.headers_names = {:'access-token' => 'access-token',
|
39
|
-
# :'client' => 'client',
|
40
|
-
# :'expiry' => 'expiry',
|
41
|
-
# :'uid' => 'uid',
|
42
|
-
# :'token-type' => 'token-type' }
|
43
|
-
|
44
|
-
# By default, only Bearer Token authentication is implemented out of the box.
|
45
|
-
# If, however, you wish to integrate with legacy Devise authentication, you can
|
46
|
-
# do so by enabling this flag. NOTE: This feature is highly experimental!
|
47
|
-
# config.enable_standard_devise_support = false
|
48
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
class DeviseTokenAuthCreateUsers < ActiveRecord::Migration[4.2]
|
2
|
-
def change
|
3
|
-
create_table(:users) do |t|
|
4
|
-
## Required
|
5
|
-
t.string :provider, :null => false, :default => "email"
|
6
|
-
t.string :uid, :null => false, :default => ""
|
7
|
-
|
8
|
-
## Database authenticatable
|
9
|
-
t.string :encrypted_password, :null => false, :default => ""
|
10
|
-
|
11
|
-
## Recoverable
|
12
|
-
t.string :reset_password_token
|
13
|
-
t.datetime :reset_password_sent_at
|
14
|
-
|
15
|
-
## Rememberable
|
16
|
-
t.datetime :remember_created_at
|
17
|
-
|
18
|
-
## Trackable
|
19
|
-
t.integer :sign_in_count, :default => 0, :null => false
|
20
|
-
t.datetime :current_sign_in_at
|
21
|
-
t.datetime :last_sign_in_at
|
22
|
-
t.string :current_sign_in_ip
|
23
|
-
t.string :last_sign_in_ip
|
24
|
-
|
25
|
-
## Confirmable
|
26
|
-
t.string :confirmation_token
|
27
|
-
t.datetime :confirmed_at
|
28
|
-
t.datetime :confirmation_sent_at
|
29
|
-
t.string :unconfirmed_email # Only if using reconfirmable
|
30
|
-
|
31
|
-
## Lockable
|
32
|
-
# t.integer :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
|
33
|
-
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
34
|
-
# t.datetime :locked_at
|
35
|
-
|
36
|
-
## User Info
|
37
|
-
t.string :name
|
38
|
-
t.string :nickname
|
39
|
-
t.string :image
|
40
|
-
t.string :email
|
41
|
-
|
42
|
-
## Tokens
|
43
|
-
t.text :tokens
|
44
|
-
|
45
|
-
t.timestamps
|
46
|
-
end
|
47
|
-
|
48
|
-
add_index :users, :email, unique: true
|
49
|
-
add_index :users, [:uid, :provider], unique: true
|
50
|
-
add_index :users, :reset_password_token, unique: true
|
51
|
-
add_index :users, :confirmation_token, unique: true
|
52
|
-
# add_index :users, :unlock_token, unique: true
|
53
|
-
end
|
54
|
-
end
|