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.

Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -2
  3. data/Rakefile +9 -4
  4. data/app/controllers/devise_token_auth/application_controller.rb +5 -7
  5. data/app/controllers/devise_token_auth/concerns/resource_finder.rb +2 -2
  6. data/app/controllers/devise_token_auth/concerns/set_user_by_token.rb +18 -10
  7. data/app/controllers/devise_token_auth/confirmations_controller.rb +2 -2
  8. data/app/controllers/devise_token_auth/omniauth_callbacks_controller.rb +17 -23
  9. data/app/controllers/devise_token_auth/passwords_controller.rb +23 -27
  10. data/app/controllers/devise_token_auth/registrations_controller.rb +17 -15
  11. data/app/controllers/devise_token_auth/sessions_controller.rb +8 -12
  12. data/app/controllers/devise_token_auth/token_validations_controller.rb +3 -3
  13. data/app/controllers/devise_token_auth/unlocks_controller.rb +10 -12
  14. data/app/models/devise_token_auth/concerns/user.rb +27 -36
  15. data/config/initializers/devise.rb +1 -1
  16. data/lib/devise_token_auth.rb +6 -6
  17. data/lib/devise_token_auth/controllers/helpers.rb +14 -4
  18. data/lib/devise_token_auth/engine.rb +11 -13
  19. data/lib/devise_token_auth/errors.rb +1 -1
  20. data/lib/devise_token_auth/rails/routes.rb +29 -29
  21. data/lib/devise_token_auth/url.rb +6 -4
  22. data/lib/devise_token_auth/version.rb +1 -1
  23. data/lib/generators/devise_token_auth/install_generator.rb +52 -39
  24. data/lib/generators/devise_token_auth/install_views_generator.rb +5 -5
  25. data/lib/generators/devise_token_auth/templates/devise_token_auth_create_users.rb.erb +1 -1
  26. data/lib/generators/devise_token_auth/templates/{user.rb → user.rb.erb} +0 -0
  27. data/test/controllers/custom/custom_confirmations_controller_test.rb +3 -1
  28. data/test/controllers/custom/custom_omniauth_callbacks_controller_test.rb +2 -0
  29. data/test/controllers/custom/custom_passwords_controller_test.rb +4 -2
  30. data/test/controllers/custom/custom_registrations_controller_test.rb +6 -8
  31. data/test/controllers/custom/custom_sessions_controller_test.rb +5 -5
  32. data/test/controllers/custom/custom_token_validations_controller_test.rb +3 -3
  33. data/test/controllers/demo_group_controller_test.rb +2 -6
  34. data/test/controllers/demo_mang_controller_test.rb +2 -5
  35. data/test/controllers/demo_user_controller_test.rb +8 -17
  36. data/test/controllers/devise_token_auth/confirmations_controller_test.rb +2 -2
  37. data/test/controllers/devise_token_auth/passwords_controller_test.rb +13 -9
  38. data/test/controllers/devise_token_auth/registrations_controller_test.rb +8 -8
  39. data/test/controllers/devise_token_auth/sessions_controller_test.rb +22 -33
  40. data/test/controllers/devise_token_auth/token_validations_controller_test.rb +2 -6
  41. data/test/controllers/devise_token_auth/unlocks_controller_test.rb +1 -1
  42. data/test/controllers/overrides/confirmations_controller_test.rb +3 -1
  43. data/test/controllers/overrides/omniauth_callbacks_controller_test.rb +3 -1
  44. data/test/controllers/overrides/passwords_controller_test.rb +25 -29
  45. data/test/controllers/overrides/registrations_controller_test.rb +4 -2
  46. data/test/controllers/overrides/sessions_controller_test.rb +4 -4
  47. data/test/controllers/overrides/token_validations_controller_test.rb +3 -3
  48. data/test/dummy/app/controllers/custom/confirmations_controller.rb +0 -2
  49. data/test/dummy/app/controllers/custom/passwords_controller.rb +1 -4
  50. data/test/dummy/app/controllers/custom/registrations_controller.rb +1 -2
  51. data/test/dummy/app/controllers/custom/sessions_controller.rb +1 -3
  52. data/test/dummy/app/controllers/custom/token_validations_controller.rb +1 -3
  53. data/test/dummy/app/controllers/overrides/confirmations_controller.rb +3 -3
  54. data/test/dummy/app/controllers/overrides/omniauth_callbacks_controller.rb +3 -3
  55. data/test/dummy/app/controllers/overrides/passwords_controller.rb +5 -5
  56. data/test/dummy/app/controllers/overrides/registrations_controller.rb +2 -2
  57. data/test/dummy/app/controllers/overrides/sessions_controller.rb +8 -10
  58. data/test/dummy/app/controllers/overrides/token_validations_controller.rb +3 -5
  59. data/test/dummy/app/helpers/application_helper.rb +1027 -1036
  60. data/test/dummy/app/models/scoped_user.rb +2 -2
  61. data/test/dummy/app/models/unregisterable_user.rb +2 -2
  62. data/test/dummy/app/models/user.rb +1 -1
  63. data/test/dummy/config.ru +5 -3
  64. data/test/dummy/config/application.rb +2 -2
  65. data/test/dummy/config/boot.rb +2 -2
  66. data/test/dummy/config/environment.rb +1 -1
  67. data/test/dummy/config/environments/development.rb +3 -3
  68. data/test/dummy/config/environments/test.rb +1 -1
  69. data/test/dummy/config/initializers/omniauth.rb +2 -2
  70. data/test/dummy/config/routes.rb +10 -29
  71. data/test/dummy/db/migrate/20140715061447_devise_token_auth_create_users.rb +8 -8
  72. data/test/dummy/db/migrate/20140715061805_devise_token_auth_create_mangs.rb +7 -7
  73. data/test/dummy/db/migrate/20141222035835_devise_token_auth_create_only_email_users.rb +4 -4
  74. data/test/dummy/db/migrate/20141222053502_devise_token_auth_create_unregisterable_users.rb +7 -7
  75. data/test/dummy/db/migrate/20150708104536_devise_token_auth_create_unconfirmable_users.rb +7 -7
  76. data/test/dummy/db/migrate/20160103235141_devise_token_auth_create_scoped_users.rb +7 -7
  77. data/test/dummy/db/migrate/20160629184441_devise_token_auth_create_lockable_users.rb +6 -6
  78. data/test/dummy/db/schema.rb +2 -60
  79. data/test/factories/users.rb +40 -0
  80. data/test/lib/devise_token_auth/url_test.rb +6 -6
  81. data/test/lib/generators/devise_token_auth/install_generator_test.rb +22 -14
  82. data/test/lib/generators/devise_token_auth/install_generator_with_namespace_test.rb +30 -22
  83. data/test/lib/generators/devise_token_auth/install_views_generator_test.rb +1 -1
  84. data/test/models/user_test.rb +15 -46
  85. data/test/support/controllers/routes.rb +43 -0
  86. data/test/test_helper.rb +12 -12
  87. metadata +8 -14
  88. data/test/dummy/app/models/evil_user.rb +0 -5
  89. data/test/dummy/app/models/nice_user.rb +0 -9
  90. data/test/dummy/db/migrate/20140928231203_devise_token_auth_create_evil_users.rb +0 -66
  91. data/test/dummy/db/migrate/20150409095712_devise_token_auth_create_nice_users.rb +0 -63
  92. 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
- :recoverable, :rememberable, :trackable, :validatable,
7
- :confirmable, :omniauthable
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
- :recoverable, :trackable, :validatable,
7
- :confirmable, :omniauthable
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 and 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]
@@ -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
- :headers => :any,
13
- :expose => ['access-token', 'expiry', 'token-type', 'uid', 'client'],
14
- :methods => [:get, :post, :options, :delete, :put]
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('../boot', __FILE__)
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 "devise_token_auth"
9
+ require 'devise_token_auth'
10
10
 
11
11
  module Dummy
12
12
  class Application < Rails::Application
@@ -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('../../../../Gemfile', __FILE__)
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('../../../../lib', __FILE__)
7
+ $LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Load the Rails application.
4
- require File.expand_path('../application', __FILE__)
4
+ require File.expand_path('application', __dir__)
5
5
 
6
6
  # Initialize the Rails application.
7
7
  Rails.application.initialize!
@@ -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 = { :host => 'devise-token-auth.dev' }
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 = { :address => 'localhost', :port => 1025 }
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 = "http://devise-token-auth.dev"
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 = { :host => 'localhost' }
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
- :fields => [:first_name, :last_name],
9
- :uid_field => :last_name
8
+ fields: [:first_name, :last_name],
9
+ uid_field: :last_name
10
10
  end
@@ -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 "Mang", at: 'mangs'
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 "ScopedUser",
51
- at: "auth",
52
- controllers: {
53
- omniauth_callbacks: "api_v2/omniauth_callbacks",
54
- sessions: "api_v2/sessions",
55
- registrations: "api_v2/registrations",
56
- confirmations: "api_v2/confirmations",
57
- passwords: "api_v2/passwords"
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, :null => false, :default => ""
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, :default => false
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, :default => 0, :null => false
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, :null => false, :default => ""
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], :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
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, :null => false, :default => ""
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, :default => false
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, :default => 0, :null => false
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, :null => false, :default => ""
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], :unique => true
60
- add_index :mangs, :reset_password_token, :unique => true
61
- add_index :mangs, :confirmation_token, :unique => true
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, :null => false
10
- t.string :uid, :null => false, :default => ""
9
+ t.string :provider, null: false
10
+ t.string :uid, null: false, default: ''
11
11
 
12
12
  ## Database authenticatable
13
- t.string :encrypted_password, :null => false, :default => ""
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], :unique => true
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, :null => false
10
- t.string :uid, :null => false, :default => ""
9
+ t.string :provider, null: false
10
+ t.string :uid, null: false, default: ''
11
11
 
12
12
  ## Database authenticatable
13
- t.string :encrypted_password, :null => false, :default => ""
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, :default => false
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, :default => 0, :null => false
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], :unique => true
59
- add_index :unregisterable_users, :reset_password_token, :unique => true
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, :null => false
10
- t.string :uid, :null => false, :default => ""
9
+ t.string :provider, null: false
10
+ t.string :uid, null: false, default: ''
11
11
 
12
12
  ## Database authenticatable
13
- t.string :encrypted_password, :null => false, :default => ""
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, :default => false
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, :default => 0, :null => false
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], :unique => true
59
- add_index :unconfirmable_users, :reset_password_token, :unique => true
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, :null => false
10
- t.string :uid, :null => false, :default => ""
9
+ t.string :provider, null: false
10
+ t.string :uid, null: false, default: ''
11
11
 
12
12
  ## Database authenticatable
13
- t.string :encrypted_password, :null => false, :default => ""
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, :default => false
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, :default => 0, :null => false
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], :unique => true
59
- add_index :scoped_users, :reset_password_token, :unique => true
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, :null => false
10
- t.string :uid, :null => false, :default => ""
9
+ t.string :provider, null: false
10
+ t.string :uid, null: false, default: ''
11
11
 
12
12
  ## Database authenticatable
13
- t.string :encrypted_password, :null => false, :default => ""
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, :default => 0, :null => false # Only if lock strategy is :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], :unique => true
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, :unique => true
61
+ add_index :lockable_users, :unlock_token, unique: true
62
62
  end
63
63
  end