devise_token_auth 0.2.0 → 1.0.0.rc1
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 +4 -4
- data/README.md +1 -2
- data/Rakefile +9 -4
- data/app/controllers/devise_token_auth/application_controller.rb +5 -7
- data/app/controllers/devise_token_auth/concerns/resource_finder.rb +2 -2
- data/app/controllers/devise_token_auth/concerns/set_user_by_token.rb +18 -10
- data/app/controllers/devise_token_auth/confirmations_controller.rb +2 -2
- data/app/controllers/devise_token_auth/omniauth_callbacks_controller.rb +17 -23
- data/app/controllers/devise_token_auth/passwords_controller.rb +23 -27
- data/app/controllers/devise_token_auth/registrations_controller.rb +17 -15
- data/app/controllers/devise_token_auth/sessions_controller.rb +8 -12
- data/app/controllers/devise_token_auth/token_validations_controller.rb +3 -3
- data/app/controllers/devise_token_auth/unlocks_controller.rb +10 -12
- data/app/models/devise_token_auth/concerns/user.rb +27 -36
- data/config/initializers/devise.rb +1 -1
- data/lib/devise_token_auth.rb +6 -6
- data/lib/devise_token_auth/controllers/helpers.rb +14 -4
- data/lib/devise_token_auth/engine.rb +11 -13
- data/lib/devise_token_auth/errors.rb +1 -1
- data/lib/devise_token_auth/rails/routes.rb +29 -29
- data/lib/devise_token_auth/url.rb +6 -4
- data/lib/devise_token_auth/version.rb +1 -1
- data/lib/generators/devise_token_auth/install_generator.rb +52 -39
- data/lib/generators/devise_token_auth/install_views_generator.rb +5 -5
- data/lib/generators/devise_token_auth/templates/devise_token_auth_create_users.rb.erb +1 -1
- data/lib/generators/devise_token_auth/templates/{user.rb → user.rb.erb} +0 -0
- data/test/controllers/custom/custom_confirmations_controller_test.rb +3 -1
- data/test/controllers/custom/custom_omniauth_callbacks_controller_test.rb +2 -0
- data/test/controllers/custom/custom_passwords_controller_test.rb +4 -2
- data/test/controllers/custom/custom_registrations_controller_test.rb +6 -8
- data/test/controllers/custom/custom_sessions_controller_test.rb +5 -5
- data/test/controllers/custom/custom_token_validations_controller_test.rb +3 -3
- data/test/controllers/demo_group_controller_test.rb +2 -6
- data/test/controllers/demo_mang_controller_test.rb +2 -5
- data/test/controllers/demo_user_controller_test.rb +8 -17
- data/test/controllers/devise_token_auth/confirmations_controller_test.rb +2 -2
- data/test/controllers/devise_token_auth/passwords_controller_test.rb +13 -9
- data/test/controllers/devise_token_auth/registrations_controller_test.rb +8 -8
- data/test/controllers/devise_token_auth/sessions_controller_test.rb +22 -33
- data/test/controllers/devise_token_auth/token_validations_controller_test.rb +2 -6
- data/test/controllers/devise_token_auth/unlocks_controller_test.rb +1 -1
- data/test/controllers/overrides/confirmations_controller_test.rb +3 -1
- data/test/controllers/overrides/omniauth_callbacks_controller_test.rb +3 -1
- data/test/controllers/overrides/passwords_controller_test.rb +25 -29
- data/test/controllers/overrides/registrations_controller_test.rb +4 -2
- data/test/controllers/overrides/sessions_controller_test.rb +4 -4
- data/test/controllers/overrides/token_validations_controller_test.rb +3 -3
- data/test/dummy/app/controllers/custom/confirmations_controller.rb +0 -2
- data/test/dummy/app/controllers/custom/passwords_controller.rb +1 -4
- data/test/dummy/app/controllers/custom/registrations_controller.rb +1 -2
- data/test/dummy/app/controllers/custom/sessions_controller.rb +1 -3
- data/test/dummy/app/controllers/custom/token_validations_controller.rb +1 -3
- data/test/dummy/app/controllers/overrides/confirmations_controller.rb +3 -3
- data/test/dummy/app/controllers/overrides/omniauth_callbacks_controller.rb +3 -3
- data/test/dummy/app/controllers/overrides/passwords_controller.rb +5 -5
- data/test/dummy/app/controllers/overrides/registrations_controller.rb +2 -2
- data/test/dummy/app/controllers/overrides/sessions_controller.rb +8 -10
- data/test/dummy/app/controllers/overrides/token_validations_controller.rb +3 -5
- data/test/dummy/app/helpers/application_helper.rb +1027 -1036
- data/test/dummy/app/models/scoped_user.rb +2 -2
- data/test/dummy/app/models/unregisterable_user.rb +2 -2
- data/test/dummy/app/models/user.rb +1 -1
- data/test/dummy/config.ru +5 -3
- data/test/dummy/config/application.rb +2 -2
- data/test/dummy/config/boot.rb +2 -2
- data/test/dummy/config/environment.rb +1 -1
- data/test/dummy/config/environments/development.rb +3 -3
- data/test/dummy/config/environments/test.rb +1 -1
- data/test/dummy/config/initializers/omniauth.rb +2 -2
- data/test/dummy/config/routes.rb +10 -29
- data/test/dummy/db/migrate/20140715061447_devise_token_auth_create_users.rb +8 -8
- data/test/dummy/db/migrate/20140715061805_devise_token_auth_create_mangs.rb +7 -7
- data/test/dummy/db/migrate/20141222035835_devise_token_auth_create_only_email_users.rb +4 -4
- data/test/dummy/db/migrate/20141222053502_devise_token_auth_create_unregisterable_users.rb +7 -7
- data/test/dummy/db/migrate/20150708104536_devise_token_auth_create_unconfirmable_users.rb +7 -7
- data/test/dummy/db/migrate/20160103235141_devise_token_auth_create_scoped_users.rb +7 -7
- data/test/dummy/db/migrate/20160629184441_devise_token_auth_create_lockable_users.rb +6 -6
- data/test/dummy/db/schema.rb +2 -60
- data/test/factories/users.rb +40 -0
- data/test/lib/devise_token_auth/url_test.rb +6 -6
- data/test/lib/generators/devise_token_auth/install_generator_test.rb +22 -14
- data/test/lib/generators/devise_token_auth/install_generator_with_namespace_test.rb +30 -22
- data/test/lib/generators/devise_token_auth/install_views_generator_test.rb +1 -1
- data/test/models/user_test.rb +15 -46
- data/test/support/controllers/routes.rb +43 -0
- data/test/test_helper.rb +12 -12
- metadata +8 -14
- data/test/dummy/app/models/evil_user.rb +0 -5
- data/test/dummy/app/models/nice_user.rb +0 -9
- data/test/dummy/db/migrate/20140928231203_devise_token_auth_create_evil_users.rb +0 -66
- data/test/dummy/db/migrate/20150409095712_devise_token_auth_create_nice_users.rb +0 -63
- data/test/integration/navigation_test.rb +0 -12
@@ -3,7 +3,7 @@
|
|
3
3
|
class ScopedUser < ActiveRecord::Base
|
4
4
|
# Include default devise modules.
|
5
5
|
devise :database_authenticatable, :registerable,
|
6
|
-
|
7
|
-
|
6
|
+
:recoverable, :rememberable, :trackable, :validatable,
|
7
|
+
:confirmable, :omniauthable
|
8
8
|
include DeviseTokenAuth::Concerns::User
|
9
9
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
class UnregisterableUser < ActiveRecord::Base
|
4
4
|
# Include default devise modules.
|
5
5
|
devise :database_authenticatable,
|
6
|
-
|
7
|
-
|
6
|
+
:recoverable, :trackable, :validatable,
|
7
|
+
:confirmable, :omniauthable
|
8
8
|
include DeviseTokenAuth::Concerns::User
|
9
9
|
end
|
@@ -8,7 +8,7 @@ class User < ActiveRecord::Base
|
|
8
8
|
|
9
9
|
def ensure_correct_favorite_color
|
10
10
|
|
11
|
-
if favorite_color
|
11
|
+
if favorite_color && (favorite_color != '')
|
12
12
|
unless ApplicationHelper::COLOR_NAMES.any?{ |s| s.casecmp(favorite_color)==0 }
|
13
13
|
matches = ApplicationHelper::COLOR_SEARCH.search(favorite_color)
|
14
14
|
closest_match = matches.last[:string]
|
data/test/dummy/config.ru
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is used by Rack-based servers to start the application.
|
2
4
|
|
3
5
|
require ::File.expand_path('../config/environment', __FILE__)
|
@@ -9,8 +11,8 @@ use Rack::Cors do
|
|
9
11
|
allow do
|
10
12
|
origins '*'
|
11
13
|
resource '*',
|
12
|
-
|
13
|
-
|
14
|
-
|
14
|
+
headers: :any,
|
15
|
+
expose: ['access-token', 'expiry', 'token-type', 'uid', 'client'],
|
16
|
+
methods: %i[get post options delete put]
|
15
17
|
end
|
16
18
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require File.expand_path('
|
3
|
+
require File.expand_path('boot', __dir__)
|
4
4
|
|
5
5
|
require 'rack/cors'
|
6
6
|
require 'rails/all'
|
7
7
|
|
8
8
|
Bundler.require(*Rails.groups)
|
9
|
-
require
|
9
|
+
require 'devise_token_auth'
|
10
10
|
|
11
11
|
module Dummy
|
12
12
|
class Application < Rails::Application
|
data/test/dummy/config/boot.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Set up gems listed in the Gemfile.
|
4
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('
|
4
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
|
5
5
|
|
6
6
|
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
7
|
-
$LOAD_PATH.unshift File.expand_path('
|
7
|
+
$LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
|
@@ -19,9 +19,9 @@ Rails.application.configure do
|
|
19
19
|
config.action_mailer.raise_delivery_errors = true
|
20
20
|
|
21
21
|
# use mailcatcher for development
|
22
|
-
config.action_mailer.default_url_options = { :
|
22
|
+
config.action_mailer.default_url_options = { host: 'devise-token-auth.dev' }
|
23
23
|
config.action_mailer.delivery_method = :smtp
|
24
|
-
config.action_mailer.smtp_settings = { :
|
24
|
+
config.action_mailer.smtp_settings = { address: 'localhost', port: 1025 }
|
25
25
|
|
26
26
|
# Print deprecation notices to the Rails logger.
|
27
27
|
config.active_support.deprecation = :log
|
@@ -42,5 +42,5 @@ Rails.application.configure do
|
|
42
42
|
# Raises error for missing translations
|
43
43
|
# config.action_view.raise_on_missing_translations = true
|
44
44
|
|
45
|
-
OmniAuth.config.full_host =
|
45
|
+
OmniAuth.config.full_host = 'http://devise-token-auth.dev'
|
46
46
|
end
|
@@ -37,7 +37,7 @@ Rails.application.configure do
|
|
37
37
|
# The :test delivery method accumulates sent emails in the
|
38
38
|
# ActionMailer::Base.deliveries array.
|
39
39
|
config.action_mailer.delivery_method = :test
|
40
|
-
config.action_mailer.default_url_options = { :
|
40
|
+
config.action_mailer.default_url_options = { host: 'localhost' }
|
41
41
|
|
42
42
|
# Print deprecation notices to the stderr.
|
43
43
|
config.active_support.deprecation = :stderr
|
@@ -5,6 +5,6 @@ Rails.application.config.middleware.use OmniAuth::Builder do |b|
|
|
5
5
|
provider :facebook, ENV['FACEBOOK_KEY'], ENV['FACEBOOK_SECRET']
|
6
6
|
provider :google_oauth2, ENV['GOOGLE_KEY'], ENV['GOOGLE_SECRET']
|
7
7
|
provider :developer,
|
8
|
-
|
9
|
-
|
8
|
+
fields: [:first_name, :last_name],
|
9
|
+
uid_field: :last_name
|
10
10
|
end
|
data/test/dummy/config/routes.rb
CHANGED
@@ -10,25 +10,7 @@ Rails.application.routes.draw do
|
|
10
10
|
|
11
11
|
# define :mangs as the second devise mapping. routes using this class will
|
12
12
|
# need to be defined within a devise_scope as shown below
|
13
|
-
mount_devise_token_auth_for
|
14
|
-
|
15
|
-
mount_devise_token_auth_for 'EvilUser', at: 'evil_user_auth', controllers: {
|
16
|
-
confirmations: 'overrides/confirmations',
|
17
|
-
passwords: 'overrides/passwords',
|
18
|
-
omniauth_callbacks: 'overrides/omniauth_callbacks',
|
19
|
-
registrations: 'overrides/registrations',
|
20
|
-
sessions: 'overrides/sessions',
|
21
|
-
token_validations: 'overrides/token_validations'
|
22
|
-
}
|
23
|
-
|
24
|
-
mount_devise_token_auth_for 'NiceUser', at: 'nice_user_auth', controllers: {
|
25
|
-
registrations: 'custom/registrations',
|
26
|
-
confirmations: 'custom/confirmations',
|
27
|
-
passwords: 'custom/passwords',
|
28
|
-
sessions: 'custom/sessions',
|
29
|
-
token_validations: 'custom/token_validations',
|
30
|
-
omniauth_callbacks: 'custom/omniauth_callbacks'
|
31
|
-
}
|
13
|
+
mount_devise_token_auth_for 'Mang', at: 'mangs'
|
32
14
|
|
33
15
|
mount_devise_token_auth_for 'OnlyEmailUser', at: 'only_email_auth', skip: [:omniauth_callbacks]
|
34
16
|
|
@@ -47,22 +29,21 @@ Rails.application.routes.draw do
|
|
47
29
|
|
48
30
|
# test namespacing with not created devise mapping
|
49
31
|
namespace :api_v2, defaults: { format: :json } do
|
50
|
-
mount_devise_token_auth_for
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
32
|
+
mount_devise_token_auth_for 'ScopedUser',
|
33
|
+
at: 'auth',
|
34
|
+
controllers: {
|
35
|
+
omniauth_callbacks: 'api_v2/omniauth_callbacks',
|
36
|
+
sessions: 'api_v2/sessions',
|
37
|
+
registrations: 'api_v2/registrations',
|
38
|
+
confirmations: 'api_v2/confirmations',
|
39
|
+
passwords: 'api_v2/passwords'
|
40
|
+
}
|
59
41
|
end
|
60
42
|
|
61
43
|
# this route will authorize visitors using the User class
|
62
44
|
get 'demo/members_only', to: 'demo_user#members_only'
|
63
45
|
get 'demo/members_only_remove_token', to: 'demo_user#members_only_remove_token'
|
64
46
|
|
65
|
-
|
66
47
|
# routes within this block will authorize visitors using the Mang class
|
67
48
|
get 'demo/members_only_mang', to: 'demo_mang#members_only'
|
68
49
|
|
@@ -7,19 +7,19 @@ class DeviseTokenAuthCreateUsers < ActiveRecord::Migration[4.2]
|
|
7
7
|
create_table(:users) do |t|
|
8
8
|
## Database authenticatable
|
9
9
|
t.string :email
|
10
|
-
t.string :encrypted_password, :
|
10
|
+
t.string :encrypted_password, null: false, default: ''
|
11
11
|
|
12
12
|
## Recoverable
|
13
13
|
t.string :reset_password_token
|
14
14
|
t.datetime :reset_password_sent_at
|
15
15
|
t.string :reset_password_redirect_url
|
16
|
-
t.boolean :allow_password_change, :
|
16
|
+
t.boolean :allow_password_change, default: false
|
17
17
|
|
18
18
|
## Rememberable
|
19
19
|
t.datetime :remember_created_at
|
20
20
|
|
21
21
|
## Trackable
|
22
|
-
t.integer :sign_in_count, :
|
22
|
+
t.integer :sign_in_count, default: 0, null: false
|
23
23
|
t.datetime :current_sign_in_at
|
24
24
|
t.datetime :last_sign_in_at
|
25
25
|
t.string :current_sign_in_ip
|
@@ -43,7 +43,7 @@ class DeviseTokenAuthCreateUsers < ActiveRecord::Migration[4.2]
|
|
43
43
|
|
44
44
|
## unique oauth id
|
45
45
|
t.string :provider
|
46
|
-
t.string :uid, :
|
46
|
+
t.string :uid, null: false, default: ''
|
47
47
|
|
48
48
|
## Tokens
|
49
49
|
if json_supported_database?
|
@@ -56,10 +56,10 @@ class DeviseTokenAuthCreateUsers < ActiveRecord::Migration[4.2]
|
|
56
56
|
end
|
57
57
|
|
58
58
|
add_index :users, :email
|
59
|
-
add_index :users, [:uid, :provider], :
|
60
|
-
add_index :users, :reset_password_token, :
|
61
|
-
add_index :users, :confirmation_token, :
|
62
|
-
add_index :users, :nickname, :
|
59
|
+
add_index :users, [:uid, :provider], unique: true
|
60
|
+
add_index :users, :reset_password_token, unique: true
|
61
|
+
add_index :users, :confirmation_token, unique: true
|
62
|
+
add_index :users, :nickname, unique: true
|
63
63
|
# add_index :users, :unlock_token, :unique => true
|
64
64
|
end
|
65
65
|
end
|
@@ -7,19 +7,19 @@ class DeviseTokenAuthCreateMangs < ActiveRecord::Migration[4.2]
|
|
7
7
|
create_table(:mangs) do |t|
|
8
8
|
## Database authenticatable
|
9
9
|
t.string :email
|
10
|
-
t.string :encrypted_password, :
|
10
|
+
t.string :encrypted_password, null: false, default: ''
|
11
11
|
|
12
12
|
## Recoverable
|
13
13
|
t.string :reset_password_token
|
14
14
|
t.datetime :reset_password_sent_at
|
15
15
|
t.string :reset_password_redirect_url
|
16
|
-
t.boolean :allow_password_change, :
|
16
|
+
t.boolean :allow_password_change, default: false
|
17
17
|
|
18
18
|
## Rememberable
|
19
19
|
t.datetime :remember_created_at
|
20
20
|
|
21
21
|
## Trackable
|
22
|
-
t.integer :sign_in_count, :
|
22
|
+
t.integer :sign_in_count, default: 0, null: false
|
23
23
|
t.datetime :current_sign_in_at
|
24
24
|
t.datetime :last_sign_in_at
|
25
25
|
t.string :current_sign_in_ip
|
@@ -43,7 +43,7 @@ class DeviseTokenAuthCreateMangs < ActiveRecord::Migration[4.2]
|
|
43
43
|
|
44
44
|
## unique oauth id
|
45
45
|
t.string :provider
|
46
|
-
t.string :uid, :
|
46
|
+
t.string :uid, null: false, default: ''
|
47
47
|
|
48
48
|
## Tokens
|
49
49
|
if json_supported_database?
|
@@ -56,9 +56,9 @@ class DeviseTokenAuthCreateMangs < ActiveRecord::Migration[4.2]
|
|
56
56
|
end
|
57
57
|
|
58
58
|
add_index :mangs, :email
|
59
|
-
add_index :mangs, [:uid, :provider], :
|
60
|
-
add_index :mangs, :reset_password_token, :
|
61
|
-
add_index :mangs, :confirmation_token, :
|
59
|
+
add_index :mangs, [:uid, :provider], unique: true
|
60
|
+
add_index :mangs, :reset_password_token, unique: true
|
61
|
+
add_index :mangs, :confirmation_token, unique: true
|
62
62
|
# add_index :mangs, :unlock_token, :unique => true
|
63
63
|
end
|
64
64
|
end
|
@@ -6,11 +6,11 @@ class DeviseTokenAuthCreateOnlyEmailUsers < ActiveRecord::Migration[4.2]
|
|
6
6
|
def change
|
7
7
|
create_table(:only_email_users) do |t|
|
8
8
|
## Required
|
9
|
-
t.string :provider, :
|
10
|
-
t.string :uid, :
|
9
|
+
t.string :provider, null: false
|
10
|
+
t.string :uid, null: false, default: ''
|
11
11
|
|
12
12
|
## Database authenticatable
|
13
|
-
t.string :encrypted_password, :
|
13
|
+
t.string :encrypted_password, null: false, default: ''
|
14
14
|
|
15
15
|
## Recoverable
|
16
16
|
#t.string :reset_password_token
|
@@ -54,7 +54,7 @@ class DeviseTokenAuthCreateOnlyEmailUsers < ActiveRecord::Migration[4.2]
|
|
54
54
|
end
|
55
55
|
|
56
56
|
add_index :only_email_users, :email
|
57
|
-
add_index :only_email_users, [:uid, :provider], :
|
57
|
+
add_index :only_email_users, [:uid, :provider], unique: true
|
58
58
|
#add_index :only_email_users, :reset_password_token, :unique => true
|
59
59
|
# add_index :only_email_users, :confirmation_token, :unique => true
|
60
60
|
# add_index :only_email_users, :unlock_token, :unique => true
|
@@ -6,22 +6,22 @@ class DeviseTokenAuthCreateUnregisterableUsers < ActiveRecord::Migration[4.2]
|
|
6
6
|
def change
|
7
7
|
create_table(:unregisterable_users) do |t|
|
8
8
|
## Required
|
9
|
-
t.string :provider, :
|
10
|
-
t.string :uid, :
|
9
|
+
t.string :provider, null: false
|
10
|
+
t.string :uid, null: false, default: ''
|
11
11
|
|
12
12
|
## Database authenticatable
|
13
|
-
t.string :encrypted_password, :
|
13
|
+
t.string :encrypted_password, null: false, default: ''
|
14
14
|
|
15
15
|
## Recoverable
|
16
16
|
t.string :reset_password_token
|
17
17
|
t.datetime :reset_password_sent_at
|
18
|
-
t.boolean :allow_password_change, :
|
18
|
+
t.boolean :allow_password_change, default: false
|
19
19
|
|
20
20
|
## Rememberable
|
21
21
|
t.datetime :remember_created_at
|
22
22
|
|
23
23
|
## Trackable
|
24
|
-
t.integer :sign_in_count, :
|
24
|
+
t.integer :sign_in_count, default: 0, null: false
|
25
25
|
t.datetime :current_sign_in_at
|
26
26
|
t.datetime :last_sign_in_at
|
27
27
|
t.string :current_sign_in_ip
|
@@ -55,8 +55,8 @@ class DeviseTokenAuthCreateUnregisterableUsers < ActiveRecord::Migration[4.2]
|
|
55
55
|
end
|
56
56
|
|
57
57
|
add_index :unregisterable_users, :email
|
58
|
-
add_index :unregisterable_users, [:uid, :provider], :
|
59
|
-
add_index :unregisterable_users, :reset_password_token, :
|
58
|
+
add_index :unregisterable_users, [:uid, :provider], unique: true
|
59
|
+
add_index :unregisterable_users, :reset_password_token, unique: true
|
60
60
|
# add_index :unregisterable_users, :confirmation_token, :unique => true
|
61
61
|
# add_index :unregisterable_users, :unlock_token, :unique => true
|
62
62
|
end
|
@@ -6,22 +6,22 @@ class DeviseTokenAuthCreateUnconfirmableUsers < ActiveRecord::Migration[4.2]
|
|
6
6
|
def change
|
7
7
|
create_table(:unconfirmable_users) do |t|
|
8
8
|
## Required
|
9
|
-
t.string :provider, :
|
10
|
-
t.string :uid, :
|
9
|
+
t.string :provider, null: false
|
10
|
+
t.string :uid, null: false, default: ''
|
11
11
|
|
12
12
|
## Database authenticatable
|
13
|
-
t.string :encrypted_password, :
|
13
|
+
t.string :encrypted_password, null: false, default: ''
|
14
14
|
|
15
15
|
## Recoverable
|
16
16
|
t.string :reset_password_token
|
17
17
|
t.datetime :reset_password_sent_at
|
18
|
-
t.boolean :allow_password_change, :
|
18
|
+
t.boolean :allow_password_change, default: false
|
19
19
|
|
20
20
|
## Rememberable
|
21
21
|
t.datetime :remember_created_at
|
22
22
|
|
23
23
|
## Trackable
|
24
|
-
t.integer :sign_in_count, :
|
24
|
+
t.integer :sign_in_count, default: 0, null: false
|
25
25
|
t.datetime :current_sign_in_at
|
26
26
|
t.datetime :last_sign_in_at
|
27
27
|
t.string :current_sign_in_ip
|
@@ -55,8 +55,8 @@ class DeviseTokenAuthCreateUnconfirmableUsers < ActiveRecord::Migration[4.2]
|
|
55
55
|
end
|
56
56
|
|
57
57
|
add_index :unconfirmable_users, :email
|
58
|
-
add_index :unconfirmable_users, [:uid, :provider], :
|
59
|
-
add_index :unconfirmable_users, :reset_password_token, :
|
58
|
+
add_index :unconfirmable_users, [:uid, :provider], unique: true
|
59
|
+
add_index :unconfirmable_users, :reset_password_token, unique: true
|
60
60
|
# add_index :nice_users, :confirmation_token, :unique => true
|
61
61
|
# add_index :nice_users, :unlock_token, :unique => true
|
62
62
|
end
|
@@ -6,22 +6,22 @@ class DeviseTokenAuthCreateScopedUsers < ActiveRecord::Migration[4.2]
|
|
6
6
|
def change
|
7
7
|
create_table(:scoped_users) do |t|
|
8
8
|
## Required
|
9
|
-
t.string :provider, :
|
10
|
-
t.string :uid, :
|
9
|
+
t.string :provider, null: false
|
10
|
+
t.string :uid, null: false, default: ''
|
11
11
|
|
12
12
|
## Database authenticatable
|
13
|
-
t.string :encrypted_password, :
|
13
|
+
t.string :encrypted_password, null: false, default: ''
|
14
14
|
|
15
15
|
## Recoverable
|
16
16
|
t.string :reset_password_token
|
17
17
|
t.datetime :reset_password_sent_at
|
18
|
-
t.boolean :allow_password_change, :
|
18
|
+
t.boolean :allow_password_change, default: false
|
19
19
|
|
20
20
|
## Rememberable
|
21
21
|
t.datetime :remember_created_at
|
22
22
|
|
23
23
|
## Trackable
|
24
|
-
t.integer :sign_in_count, :
|
24
|
+
t.integer :sign_in_count, default: 0, null: false
|
25
25
|
t.datetime :current_sign_in_at
|
26
26
|
t.datetime :last_sign_in_at
|
27
27
|
t.string :current_sign_in_ip
|
@@ -55,8 +55,8 @@ class DeviseTokenAuthCreateScopedUsers < ActiveRecord::Migration[4.2]
|
|
55
55
|
end
|
56
56
|
|
57
57
|
add_index :scoped_users, :email
|
58
|
-
add_index :scoped_users, [:uid, :provider], :
|
59
|
-
add_index :scoped_users, :reset_password_token, :
|
58
|
+
add_index :scoped_users, [:uid, :provider], unique: true
|
59
|
+
add_index :scoped_users, :reset_password_token, unique: true
|
60
60
|
# add_index :scoped_users, :confirmation_token, :unique => true
|
61
61
|
# add_index :scoped_users, :unlock_token, :unique => true
|
62
62
|
end
|
@@ -6,11 +6,11 @@ class DeviseTokenAuthCreateLockableUsers < ActiveRecord::Migration[4.2]
|
|
6
6
|
def change
|
7
7
|
create_table(:lockable_users) do |t|
|
8
8
|
## Required
|
9
|
-
t.string :provider, :
|
10
|
-
t.string :uid, :
|
9
|
+
t.string :provider, null: false
|
10
|
+
t.string :uid, null: false, default: ''
|
11
11
|
|
12
12
|
## Database authenticatable
|
13
|
-
t.string :encrypted_password, :
|
13
|
+
t.string :encrypted_password, null: false, default: ''
|
14
14
|
|
15
15
|
## Recoverable
|
16
16
|
# t.string :reset_password_token
|
@@ -34,7 +34,7 @@ class DeviseTokenAuthCreateLockableUsers < ActiveRecord::Migration[4.2]
|
|
34
34
|
# t.string :unconfirmed_email # Only if using reconfirmable
|
35
35
|
|
36
36
|
## Lockable
|
37
|
-
t.integer :failed_attempts, :
|
37
|
+
t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
|
38
38
|
t.string :unlock_token # Only if unlock strategy is :email or :both
|
39
39
|
t.datetime :locked_at
|
40
40
|
|
@@ -55,9 +55,9 @@ class DeviseTokenAuthCreateLockableUsers < ActiveRecord::Migration[4.2]
|
|
55
55
|
end
|
56
56
|
|
57
57
|
add_index :lockable_users, :email
|
58
|
-
add_index :lockable_users, [:uid, :provider], :
|
58
|
+
add_index :lockable_users, [:uid, :provider], unique: true
|
59
59
|
# add_index :lockable_users, :reset_password_token, :unique => true
|
60
60
|
# add_index :lockable_users, :confirmation_token, :unique => true
|
61
|
-
add_index :lockable_users, :unlock_token, :
|
61
|
+
add_index :lockable_users, :unlock_token, unique: true
|
62
62
|
end
|
63
63
|
end
|