devise_jwt_auth 0.1.1 → 0.1.6

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.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/app/controllers/devise_jwt_auth/application_controller.rb +15 -13
  4. data/app/controllers/devise_jwt_auth/concerns/resource_finder.rb +2 -6
  5. data/app/controllers/devise_jwt_auth/concerns/{set_user_by_jwt_token.rb → set_user_by_token.rb} +23 -19
  6. data/app/controllers/devise_jwt_auth/confirmations_controller.rb +10 -19
  7. data/app/controllers/devise_jwt_auth/omniauth_callbacks_controller.rb +32 -33
  8. data/app/controllers/devise_jwt_auth/passwords_controller.rb +29 -19
  9. data/app/controllers/devise_jwt_auth/refresh_token_controller.rb +4 -1
  10. data/app/controllers/devise_jwt_auth/registrations_controller.rb +40 -21
  11. data/app/controllers/devise_jwt_auth/sessions_controller.rb +21 -21
  12. data/app/controllers/devise_jwt_auth/unlocks_controller.rb +5 -4
  13. data/app/models/devise_jwt_auth/concerns/active_record_support.rb +3 -0
  14. data/app/models/devise_jwt_auth/concerns/confirmable_support.rb +7 -4
  15. data/app/models/devise_jwt_auth/concerns/mongoid_support.rb +3 -0
  16. data/app/models/devise_jwt_auth/concerns/tokens_serialization.rb +4 -1
  17. data/app/models/devise_jwt_auth/concerns/user.rb +18 -9
  18. data/app/models/devise_jwt_auth/concerns/user_omniauth_callbacks.rb +11 -3
  19. data/app/validators/devise_jwt_auth_email_validator.rb +5 -4
  20. data/lib/devise_jwt_auth/blacklist.rb +2 -0
  21. data/lib/devise_jwt_auth/controllers/url_helpers.rb +1 -2
  22. data/lib/devise_jwt_auth/engine.rb +4 -4
  23. data/lib/devise_jwt_auth/rails/routes.rb +35 -24
  24. data/lib/devise_jwt_auth/token_factory.rb +3 -2
  25. data/lib/devise_jwt_auth/url.rb +2 -4
  26. data/lib/devise_jwt_auth/version.rb +1 -1
  27. data/lib/generators/devise_jwt_auth/install_generator.rb +7 -6
  28. data/lib/generators/devise_jwt_auth/install_generator_helpers.rb +27 -6
  29. data/lib/generators/devise_jwt_auth/install_mongoid_generator.rb +3 -2
  30. data/lib/generators/devise_jwt_auth/templates/devise_jwt_auth.rb +15 -16
  31. data/lib/generators/devise_jwt_auth/templates/devise_jwt_auth_create_users.rb.erb +15 -11
  32. data/lib/generators/devise_jwt_auth/templates/user.rb.erb +2 -2
  33. data/test/controllers/custom/custom_confirmations_controller_test.rb +2 -2
  34. data/test/controllers/custom/custom_passwords_controller_test.rb +4 -4
  35. data/test/controllers/custom/custom_refresh_token_controller_test.rb +2 -3
  36. data/test/controllers/custom/custom_registrations_controller_test.rb +2 -2
  37. data/test/controllers/demo_mang_controller_test.rb +206 -210
  38. data/test/controllers/demo_user_controller_test.rb +358 -374
  39. data/test/controllers/devise_jwt_auth/confirmations_controller_test.rb +5 -5
  40. data/test/controllers/devise_jwt_auth/omniauth_callbacks_controller_test.rb +6 -7
  41. data/test/controllers/devise_jwt_auth/passwords_controller_test.rb +11 -13
  42. data/test/controllers/devise_jwt_auth/refresh_token_controller_test.rb +8 -12
  43. data/test/controllers/devise_jwt_auth/registrations_controller_test.rb +23 -25
  44. data/test/controllers/devise_jwt_auth/sessions_controller_test.rb +32 -34
  45. data/test/controllers/devise_jwt_auth/unlocks_controller_test.rb +2 -2
  46. data/test/controllers/overrides/confirmations_controller_test.rb +1 -1
  47. data/test/controllers/overrides/passwords_controller_test.rb +1 -1
  48. data/test/controllers/overrides/refresh_token_controller_test.rb +1 -2
  49. data/test/controllers/overrides/registrations_controller_test.rb +1 -1
  50. data/test/dummy/app/controllers/application_controller.rb +1 -1
  51. data/test/dummy/app/controllers/custom/refresh_token_controller.rb +2 -1
  52. data/test/dummy/app/controllers/custom/registrations_controller.rb +1 -1
  53. data/test/dummy/app/controllers/overrides/confirmations_controller.rb +4 -4
  54. data/test/dummy/app/controllers/overrides/omniauth_callbacks_controller.rb +4 -4
  55. data/test/dummy/app/controllers/overrides/passwords_controller.rb +4 -4
  56. data/test/dummy/app/controllers/overrides/refresh_token_controller.rb +1 -1
  57. data/test/dummy/app/controllers/overrides/registrations_controller.rb +2 -2
  58. data/test/dummy/app/controllers/overrides/sessions_controller.rb +2 -2
  59. data/test/dummy/app/models/concerns/favorite_color.rb +11 -9
  60. data/test/dummy/config.ru +2 -2
  61. data/test/dummy/config/application.rb +1 -0
  62. data/test/dummy/config/boot.rb +1 -1
  63. data/test/dummy/config/environments/test.rb +11 -7
  64. data/test/dummy/config/initializers/figaro.rb +1 -1
  65. data/test/dummy/config/initializers/omniauth.rb +2 -2
  66. data/test/dummy/config/routes.rb +8 -8
  67. data/test/dummy/db/migrate/{20140715061447_devise_token_auth_create_users.rb → 20140715061447_devise_jwt_auth_create_users.rb} +0 -0
  68. data/test/dummy/db/migrate/{20140715061805_devise_token_auth_create_mangs.rb → 20140715061805_devise_jwt_auth_create_mangs.rb} +0 -0
  69. data/test/dummy/db/migrate/{20141222035835_devise_token_auth_create_only_email_users.rb → 20141222035835_devise_jwt_auth_create_only_email_users.rb} +9 -9
  70. data/test/dummy/db/migrate/{20141222053502_devise_token_auth_create_unregisterable_users.rb → 20141222053502_devise_jwt_auth_create_unregisterable_users.rb} +0 -0
  71. data/test/dummy/db/migrate/{20150708104536_devise_token_auth_create_unconfirmable_users.rb → 20150708104536_devise_jwt_auth_create_unconfirmable_users.rb} +0 -0
  72. data/test/dummy/db/migrate/{20160103235141_devise_token_auth_create_scoped_users.rb → 20160103235141_devise_jwt_auth_create_scoped_users.rb} +0 -0
  73. data/test/dummy/db/migrate/{20160629184441_devise_token_auth_create_lockable_users.rb → 20160629184441_devise_jwt_auth_create_lockable_users.rb} +0 -0
  74. data/test/dummy/db/migrate/{20190924101113_devise_token_auth_create_confirmable_users.rb → 20190924101113_devise_jwt_auth_create_confirmable_users.rb} +6 -5
  75. data/test/dummy/db/schema.rb +170 -170
  76. data/test/dummy/tmp/generators/app/controllers/application_controller.rb +6 -0
  77. data/test/dummy/tmp/generators/app/models/user.rb +9 -0
  78. data/test/dummy/tmp/generators/config/initializers/devise_jwt_auth.rb +73 -0
  79. data/test/dummy/tmp/generators/db/migrate/20201006030349_devise_jwt_auth_create_users.rb +54 -0
  80. data/test/factories/users.rb +5 -3
  81. data/test/lib/devise_jwt_auth/token_factory_test.rb +6 -6
  82. data/test/lib/generators/devise_jwt_auth/install_generator_test.rb +3 -20
  83. data/test/lib/generators/devise_jwt_auth/install_generator_with_namespace_test.rb +4 -21
  84. data/test/models/concerns/tokens_serialization_test.rb +68 -68
  85. data/test/models/user_test.rb +35 -37
  86. data/test/support/controllers/routes.rb +7 -5
  87. data/test/test_helper.rb +1 -1
  88. metadata +70 -76
@@ -20,7 +20,7 @@ class Overrides::ConfirmationsControllerTest < ActionDispatch::IntegrationTest
20
20
  @new_user.send_confirmation_instructions(redirect_url: @redirect_url)
21
21
 
22
22
  @mail = ActionMailer::Base.deliveries.last
23
- @confirmation_path = @mail.body.match(/localhost([^\"]*)\"/)[1]
23
+ @confirmation_path = @mail.body.match(/localhost([^"]*)"/)[1]
24
24
 
25
25
  # visit confirmation link
26
26
  get @confirmation_path
@@ -24,7 +24,7 @@ class Overrides::PasswordsControllerTest < ActionDispatch::IntegrationTest
24
24
  mail = ActionMailer::Base.deliveries.last
25
25
  @resource.reload
26
26
 
27
- mail_reset_token = mail.body.match(/reset_password_token=(.*)\"/)[1]
27
+ mail_reset_token = mail.body.match(/reset_password_token=(.*)"/)[1]
28
28
  mail_redirect_url = CGI.unescape(mail.body.match(/redirect_url=([^&]*)&/)[1])
29
29
 
30
30
  get '/evil_user_auth/password/edit',
@@ -15,8 +15,7 @@ class Overrides::RefreshTokenControllerTest < ActionDispatch::IntegrationTest
15
15
  before do
16
16
  @resource = create(:user, :confirmed)
17
17
  @auth_headers = get_cookie_header(DeviseJwtAuth.refresh_token_name,
18
- @resource.create_refresh_token
19
- )
18
+ @resource.create_refresh_token)
20
19
 
21
20
  get '/evil_user_auth/refresh_token',
22
21
  params: {},
@@ -14,7 +14,7 @@ class Overrides::RegistrationsControllerTest < ActionDispatch::IntegrationTest
14
14
  describe Overrides::RegistrationsController do
15
15
  describe 'Succesful Registration update' do
16
16
  before do
17
- @existing_user = create(:user, :confirmed)
17
+ @existing_user = create(:user, :confirmed)
18
18
  @auth_headers = @existing_user.create_named_token_pair
19
19
 
20
20
  # @client_id = @auth_headers['client']
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ApplicationController < ActionController::Base
4
- include DeviseJwtAuth::Concerns::SetUserByJwtToken
4
+ include DeviseJwtAuth::Concerns::SetUserByToken
5
5
 
6
6
  before_action :configure_permitted_parameters, if: :devise_controller?
7
7
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Custom
3
4
  class RefreshTokenController < DeviseJwtAuth::RefreshTokenController
4
5
  def show
@@ -17,4 +18,4 @@ module Custom
17
18
  render json: { custom: 'foo' }
18
19
  end
19
20
  end
20
- end
21
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  class Custom::RegistrationsController < DeviseJwtAuth::RegistrationsController
4
4
  def create
5
- super do |resource|
5
+ super do |_resource|
6
6
  @create_block_called = true
7
7
  end
8
8
  end
@@ -5,18 +5,18 @@ module Overrides
5
5
  def show
6
6
  @resource = resource_class.confirm_by_token(params[:confirmation_token])
7
7
 
8
- if @resource && @resource.id
8
+ if @resource&.id
9
9
  # token = @resource.create_token
10
10
  # @resource.save!
11
-
11
+
12
12
  update_refresh_token_cookie
13
13
  redirect_header_options = {
14
14
  account_confirmation_success: true,
15
15
  config: params[:config],
16
16
  override_proof: '(^^,)'
17
17
  }
18
- redirect_headers = @resource.create_named_token_pair.
19
- merge(redirect_header_options)
18
+ redirect_headers = @resource.create_named_token_pair
19
+ .merge(redirect_header_options)
20
20
  redirect_to_link = DeviseJwtAuth::Url.generate(params[:redirect_url], redirect_headers)
21
21
  redirect_to redirect_to_link
22
22
  # redirect_header_options = {
@@ -2,14 +2,14 @@
2
2
 
3
3
  module Overrides
4
4
  class OmniauthCallbacksController < DeviseJwtAuth::OmniauthCallbacksController
5
- DEFAULT_NICKNAME = 'stimpy'.freeze
5
+ DEFAULT_NICKNAME = 'stimpy'
6
6
 
7
7
  def assign_provider_attrs(user, auth_hash)
8
8
  user.assign_attributes(
9
9
  nickname: DEFAULT_NICKNAME,
10
- name: auth_hash['info']['name'],
11
- image: auth_hash['info']['image'],
12
- email: auth_hash['info']['email']
10
+ name: auth_hash['info']['name'],
11
+ image: auth_hash['info']['image'],
12
+ email: auth_hash['info']['email']
13
13
  )
14
14
  end
15
15
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Overrides
4
4
  class PasswordsController < DeviseJwtAuth::PasswordsController
5
- OVERRIDE_PROOF = '(^^,)'.freeze
5
+ OVERRIDE_PROOF = '(^^,)'
6
6
 
7
7
  # this is where users arrive after visiting the email confirmation link
8
8
  def edit
@@ -10,7 +10,7 @@ module Overrides
10
10
  reset_password_token: resource_params[:reset_password_token]
11
11
  )
12
12
 
13
- if @resource && @resource.id
13
+ if @resource&.id
14
14
  # token = @resource.create_token
15
15
 
16
16
  # ensure that user is confirmed
@@ -23,8 +23,8 @@ module Overrides
23
23
  override_proof: OVERRIDE_PROOF,
24
24
  reset_password: true
25
25
  }
26
- redirect_headers = @resource.create_named_token_pair.
27
- merge(redirect_header_options)
26
+ redirect_headers = @resource.create_named_token_pair
27
+ .merge(redirect_header_options)
28
28
  redirect_to_link = DeviseJwtAuth::Url.generate(params[:redirect_url], redirect_headers)
29
29
  redirect_to redirect_to_link
30
30
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Overrides
4
4
  class RefreshTokenController < DeviseJwtAuth::RefreshTokenController
5
- OVERRIDE_PROOF = '(^^,)'.freeze
5
+ OVERRIDE_PROOF = '(^^,)'
6
6
  def show
7
7
  # @resource will have been set by set_user_by_token concern
8
8
  if @resource
@@ -2,14 +2,14 @@
2
2
 
3
3
  module Overrides
4
4
  class RegistrationsController < DeviseJwtAuth::RegistrationsController
5
- OVERRIDE_PROOF = '(^^,)'.freeze
5
+ OVERRIDE_PROOF = '(^^,)'
6
6
 
7
7
  def update
8
8
  if @resource
9
9
  if @resource.update(account_update_params)
10
10
  render json: {
11
11
  status: 'success',
12
- data: @resource.as_json,
12
+ data: @resource.as_json,
13
13
  override_proof: OVERRIDE_PROOF
14
14
  }
15
15
  else
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Overrides
4
4
  class SessionsController < DeviseJwtAuth::SessionsController
5
- OVERRIDE_PROOF = '(^^,)'.freeze
5
+ OVERRIDE_PROOF = '(^^,)'
6
6
 
7
7
  def create
8
8
  @resource = resource_class.dta_find_by(email: resource_params[:email])
@@ -16,7 +16,7 @@ module Overrides
16
16
  override_proof: OVERRIDE_PROOF
17
17
  }.merge(auth_header)
18
18
 
19
- elsif @resource && (not @resource.confirmed?)
19
+ elsif @resource && !@resource.confirmed?
20
20
  render json: {
21
21
  success: false,
22
22
  errors: [
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FavoriteColor
2
4
  extend ActiveSupport::Concern
3
5
 
@@ -5,15 +7,15 @@ module FavoriteColor
5
7
  validates :operating_thetan, numericality: true, allow_nil: true
6
8
  validate :ensure_correct_favorite_color
7
9
  end
8
-
10
+
9
11
  def ensure_correct_favorite_color
10
- if favorite_color && (favorite_color != '')
11
- unless ApplicationHelper::COLOR_NAMES.any?{ |s| s.casecmp(favorite_color)==0 }
12
- matches = ApplicationHelper::COLOR_SEARCH.search(favorite_color)
13
- closest_match = matches.last[:string]
14
- second_closest_match = matches[-2][:string]
15
- errors.add(:favorite_color, "We've never heard of the color \"#{favorite_color}\". Did you mean \"#{closest_match}\"? Or perhaps \"#{second_closest_match}\"?")
16
- end
17
- end
12
+ return unless favorite_color && (favorite_color != '')
13
+
14
+ return if ApplicationHelper::COLOR_NAMES.any? { |s| s.casecmp(favorite_color).zero? }
15
+
16
+ matches = ApplicationHelper::COLOR_SEARCH.search(favorite_color)
17
+ closest_match = matches.last[:string]
18
+ second_closest_match = matches[-2][:string]
19
+ errors.add(:favorite_color, "We've never heard of the color \"#{favorite_color}\". Did you mean \"#{closest_match}\"? Or perhaps \"#{second_closest_match}\"?")
18
20
  end
19
21
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This file is used by Rack-based servers to start the application.
4
4
 
5
- require ::File.expand_path('../config/environment', __FILE__)
5
+ require ::File.expand_path('config/environment', __dir__)
6
6
  run Rails.application
7
7
 
8
8
  # allow cross origin requests
@@ -12,7 +12,7 @@ use Rack::Cors do
12
12
  origins '*'
13
13
  resource '*',
14
14
  headers: :any,
15
- expose: ['access-token', 'expiry', 'token-type', 'uid', 'client'],
15
+ expose: %w[access-token expiry token-type uid client],
16
16
  methods: %i[get post options delete put]
17
17
  end
18
18
  end
@@ -19,6 +19,7 @@ begin
19
19
  require 'mongoid-locker'
20
20
  end
21
21
  rescue LoadError
22
+ raise StandardError, 'Unsupported ORM'
22
23
  end
23
24
 
24
25
  require 'devise_jwt_auth'
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  unless defined?(DEVISE_JWT_AUTH_ORM)
4
- DEVISE_JWT_AUTH_ORM = (ENV["DEVISE_JWT_AUTH_ORM"] || :active_record).to_sym
4
+ DEVISE_JWT_AUTH_ORM = (ENV['DEVISE_JWT_AUTH_ORM'] || :active_record).to_sym
5
5
  end
6
6
 
7
7
  # Set up gems listed in the Gemfile.
@@ -15,13 +15,17 @@ Rails.application.configure do
15
15
  config.eager_load = false
16
16
 
17
17
  # Configure static asset server for tests with Cache-Control for performance.
18
- Rails::VERSION::MAJOR == 5 ?
19
- (config.public_file_server.enabled = true) :
20
- (config.serve_static_files = true)
21
-
22
- Rails::VERSION::MAJOR == 5 ?
23
- (config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }) :
24
- (config.static_cache_control = 'public, max-age=3600')
18
+ if Rails::VERSION::MAJOR == 5
19
+ (config.public_file_server.enabled = true)
20
+ else
21
+ (config.serve_static_files = true)
22
+ end
23
+
24
+ if Rails::VERSION::MAJOR == 5
25
+ (config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' })
26
+ else
27
+ (config.static_cache_control = 'public, max-age=3600')
28
+ end
25
29
 
26
30
  # Show full error reports and disable caching.
27
31
  config.consider_all_requests_local = true
@@ -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", "APPLE_CLIENT_ID", "APPLE_TEAM_ID", "APPLE_KEY", "APPLE_PEM")
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")
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Rails.application.config.middleware.use OmniAuth::Builder do |b|
4
- provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET'], scope: 'email,profile'
3
+ Rails.application.config.middleware.use OmniAuth::Builder do |_b|
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
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'] }
@@ -32,14 +32,14 @@ Rails.application.routes.draw do
32
32
  # test namespacing with not created devise mapping
33
33
  namespace :api_v2, defaults: { format: :json } do
34
34
  mount_devise_jwt_auth_for 'ScopedUser',
35
- at: 'auth',
36
- controllers: {
37
- omniauth_callbacks: 'api_v2/omniauth_callbacks',
38
- sessions: 'api_v2/sessions',
39
- registrations: 'api_v2/registrations',
40
- confirmations: 'api_v2/confirmations',
41
- passwords: 'api_v2/passwords'
42
- }
35
+ at: 'auth',
36
+ controllers: {
37
+ omniauth_callbacks: 'api_v2/omniauth_callbacks',
38
+ sessions: 'api_v2/sessions',
39
+ registrations: 'api_v2/registrations',
40
+ confirmations: 'api_v2/confirmations',
41
+ passwords: 'api_v2/passwords'
42
+ }
43
43
  end
44
44
 
45
45
  # this route will authorize visitors using the User class
@@ -13,17 +13,17 @@ class DeviseJwtAuthCreateOnlyEmailUsers < ActiveRecord::Migration[4.2]
13
13
  t.string :encrypted_password, null: false, default: ''
14
14
 
15
15
  ## Recoverable
16
- #t.string :reset_password_token
17
- #t.datetime :reset_password_sent_at
16
+ # t.string :reset_password_token
17
+ # t.datetime :reset_password_sent_at
18
18
 
19
19
  ## Rememberable
20
- #t.datetime :remember_created_at
20
+ # t.datetime :remember_created_at
21
21
 
22
22
  ## Confirmable
23
- #t.string :confirmation_token
24
- #t.datetime :confirmed_at
25
- #t.datetime :confirmation_sent_at
26
- #t.string :unconfirmed_email # Only if using reconfirmable
23
+ # t.string :confirmation_token
24
+ # t.datetime :confirmed_at
25
+ # t.datetime :confirmation_sent_at
26
+ # t.string :unconfirmed_email # Only if using reconfirmable
27
27
 
28
28
  ## Lockable
29
29
  # t.integer :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
@@ -47,8 +47,8 @@ class DeviseJwtAuthCreateOnlyEmailUsers < ActiveRecord::Migration[4.2]
47
47
  end
48
48
 
49
49
  add_index :only_email_users, :email
50
- add_index :only_email_users, [:uid, :provider], unique: true
51
- #add_index :only_email_users, :reset_password_token, :unique => true
50
+ add_index :only_email_users, [:uid, :provider], unique: true
51
+ # add_index :only_email_users, :reset_password_token, :unique => true
52
52
  # add_index :only_email_users, :confirmation_token, :unique => true
53
53
  # add_index :only_email_users, :unlock_token, :unique => true
54
54
  end
@@ -1,18 +1,19 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class DeviseJwtAuthCreateConfirmableUsers < ActiveRecord::Migration[5.2]
2
4
  def change
3
-
4
5
  create_table(:confirmable_users) do |t|
5
6
  ## Required
6
- t.string :provider, :null => false, :default => "email"
7
- t.string :uid, :null => false, :default => ""
7
+ t.string :provider, null: false, default: 'email'
8
+ t.string :uid, null: false, default: ''
8
9
 
9
10
  ## Database authenticatable
10
- t.string :encrypted_password, :null => false, :default => ""
11
+ t.string :encrypted_password, null: false, default: ''
11
12
 
12
13
  ## Recoverable
13
14
  t.string :reset_password_token
14
15
  t.datetime :reset_password_sent_at
15
- t.boolean :allow_password_change, :default => false
16
+ t.boolean :allow_password_change, default: false
16
17
 
17
18
  ## Rememberable
18
19
  t.datetime :remember_created_at
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is auto-generated from the current state of the database. Instead
2
4
  # of editing this file, please use the migrations feature of Active Record to
3
5
  # incrementally modify your database, and then regenerate this schema definition.
@@ -10,189 +12,187 @@
10
12
  #
11
13
  # It's strongly recommended that you check this file into your version control system.
12
14
 
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
15
+ ActiveRecord::Schema.define(version: 20_190_924_101_113) do
16
+ create_table 'confirmable_users', force: :cascade do |t|
17
+ t.string 'provider', default: 'email', null: false
18
+ t.string 'uid', default: '', null: false
19
+ t.string 'encrypted_password', default: '', null: false
20
+ t.string 'reset_password_token'
21
+ t.datetime 'reset_password_sent_at'
22
+ t.boolean 'allow_password_change', default: false
23
+ t.datetime 'remember_created_at'
24
+ t.string 'confirmation_token'
25
+ t.datetime 'confirmed_at'
26
+ t.datetime 'confirmation_sent_at'
27
+ t.string 'unconfirmed_email'
28
+ t.string 'name'
29
+ t.string 'nickname'
30
+ t.string 'image'
31
+ t.string 'email'
32
+ t.text 'tokens'
33
+ t.datetime 'created_at', null: false
34
+ t.datetime 'updated_at', null: false
35
+ t.index ['confirmation_token'], name: 'index_confirmable_users_on_confirmation_token', unique: true
36
+ t.index ['email'], name: 'index_confirmable_users_on_email', unique: true
37
+ t.index ['reset_password_token'], name: 'index_confirmable_users_on_reset_password_token', unique: true
38
+ t.index ['uid', 'provider'], name: 'index_confirmable_users_on_uid_and_provider', unique: true
38
39
  end
39
40
 
40
- create_table "lockable_users", force: :cascade do |t|
41
- t.string "provider", null: false
42
- t.string "uid", default: "", null: false
43
- t.string "encrypted_password", default: "", null: false
44
- t.integer "failed_attempts", default: 0, null: false
45
- t.string "unlock_token"
46
- t.datetime "locked_at"
47
- t.string "name"
48
- t.string "nickname"
49
- t.string "image"
50
- t.string "email"
51
- t.text "tokens"
52
- t.datetime "created_at"
53
- t.datetime "updated_at"
54
- t.index ["email"], name: "index_lockable_users_on_email"
55
- t.index ["uid", "provider"], name: "index_lockable_users_on_uid_and_provider", unique: true
56
- t.index ["unlock_token"], name: "index_lockable_users_on_unlock_token", unique: true
41
+ create_table 'lockable_users', force: :cascade do |t|
42
+ t.string 'provider', null: false
43
+ t.string 'uid', default: '', null: false
44
+ t.string 'encrypted_password', default: '', null: false
45
+ t.integer 'failed_attempts', default: 0, null: false
46
+ t.string 'unlock_token'
47
+ t.datetime 'locked_at'
48
+ t.string 'name'
49
+ t.string 'nickname'
50
+ t.string 'image'
51
+ t.string 'email'
52
+ t.text 'tokens'
53
+ t.datetime 'created_at'
54
+ t.datetime 'updated_at'
55
+ t.index ['email'], name: 'index_lockable_users_on_email'
56
+ t.index ['uid', 'provider'], name: 'index_lockable_users_on_uid_and_provider', unique: true
57
+ t.index ['unlock_token'], name: 'index_lockable_users_on_unlock_token', unique: true
57
58
  end
58
59
 
59
- create_table "mangs", force: :cascade do |t|
60
- t.string "email"
61
- t.string "encrypted_password", default: "", null: false
62
- t.string "reset_password_token"
63
- t.datetime "reset_password_sent_at"
64
- t.string "reset_password_redirect_url"
65
- t.boolean "allow_password_change", default: false
66
- t.datetime "remember_created_at"
67
- t.string "confirmation_token"
68
- t.datetime "confirmed_at"
69
- t.datetime "confirmation_sent_at"
70
- t.string "unconfirmed_email"
71
- t.string "name"
72
- t.string "nickname"
73
- t.string "image"
74
- t.string "provider"
75
- t.string "uid", default: "", null: false
76
- t.text "tokens"
77
- t.datetime "created_at"
78
- t.datetime "updated_at"
79
- t.string "favorite_color"
80
- t.index ["confirmation_token"], name: "index_mangs_on_confirmation_token", unique: true
81
- t.index ["email"], name: "index_mangs_on_email"
82
- t.index ["reset_password_token"], name: "index_mangs_on_reset_password_token", unique: true
83
- t.index ["uid", "provider"], name: "index_mangs_on_uid_and_provider", unique: true
60
+ create_table 'mangs', force: :cascade do |t|
61
+ t.string 'email'
62
+ t.string 'encrypted_password', default: '', null: false
63
+ t.string 'reset_password_token'
64
+ t.datetime 'reset_password_sent_at'
65
+ t.string 'reset_password_redirect_url'
66
+ t.boolean 'allow_password_change', default: false
67
+ t.datetime 'remember_created_at'
68
+ t.string 'confirmation_token'
69
+ t.datetime 'confirmed_at'
70
+ t.datetime 'confirmation_sent_at'
71
+ t.string 'unconfirmed_email'
72
+ t.string 'name'
73
+ t.string 'nickname'
74
+ t.string 'image'
75
+ t.string 'provider'
76
+ t.string 'uid', default: '', null: false
77
+ t.text 'tokens'
78
+ t.datetime 'created_at'
79
+ t.datetime 'updated_at'
80
+ t.string 'favorite_color'
81
+ t.index ['confirmation_token'], name: 'index_mangs_on_confirmation_token', unique: true
82
+ t.index ['email'], name: 'index_mangs_on_email'
83
+ t.index ['reset_password_token'], name: 'index_mangs_on_reset_password_token', unique: true
84
+ t.index ['uid', 'provider'], name: 'index_mangs_on_uid_and_provider', unique: true
84
85
  end
85
86
 
86
- create_table "only_email_users", force: :cascade do |t|
87
- t.string "provider", null: false
88
- t.string "uid", default: "", null: false
89
- t.string "encrypted_password", default: "", null: false
90
- t.string "name"
91
- t.string "nickname"
92
- t.string "image"
93
- t.string "email"
94
- t.text "tokens"
95
- t.datetime "created_at"
96
- t.datetime "updated_at"
97
- t.index ["email"], name: "index_only_email_users_on_email"
98
- t.index ["uid", "provider"], name: "index_only_email_users_on_uid_and_provider", unique: true
87
+ create_table 'only_email_users', force: :cascade do |t|
88
+ t.string 'provider', null: false
89
+ t.string 'uid', default: '', null: false
90
+ t.string 'encrypted_password', default: '', null: false
91
+ t.string 'name'
92
+ t.string 'nickname'
93
+ t.string 'image'
94
+ t.string 'email'
95
+ t.text 'tokens'
96
+ t.datetime 'created_at'
97
+ t.datetime 'updated_at'
98
+ t.index ['email'], name: 'index_only_email_users_on_email'
99
+ t.index ['uid', 'provider'], name: 'index_only_email_users_on_uid_and_provider', unique: true
99
100
  end
100
101
 
101
- create_table "scoped_users", force: :cascade do |t|
102
- t.string "provider", null: false
103
- t.string "uid", default: "", null: false
104
- t.string "encrypted_password", default: "", null: false
105
- t.string "reset_password_token"
106
- t.datetime "reset_password_sent_at"
107
- t.boolean "allow_password_change", default: false
108
- t.datetime "remember_created_at"
109
- t.string "confirmation_token"
110
- t.datetime "confirmed_at"
111
- t.datetime "confirmation_sent_at"
112
- t.string "unconfirmed_email"
113
- t.string "name"
114
- t.string "nickname"
115
- t.string "image"
116
- t.string "email"
117
- t.text "tokens"
118
- t.datetime "created_at"
119
- t.datetime "updated_at"
120
- t.index ["email"], name: "index_scoped_users_on_email"
121
- t.index ["reset_password_token"], name: "index_scoped_users_on_reset_password_token", unique: true
122
- t.index ["uid", "provider"], name: "index_scoped_users_on_uid_and_provider", unique: true
102
+ create_table 'scoped_users', force: :cascade do |t|
103
+ t.string 'provider', null: false
104
+ t.string 'uid', default: '', null: false
105
+ t.string 'encrypted_password', default: '', null: false
106
+ t.string 'reset_password_token'
107
+ t.datetime 'reset_password_sent_at'
108
+ t.boolean 'allow_password_change', default: false
109
+ t.datetime 'remember_created_at'
110
+ t.string 'confirmation_token'
111
+ t.datetime 'confirmed_at'
112
+ t.datetime 'confirmation_sent_at'
113
+ t.string 'unconfirmed_email'
114
+ t.string 'name'
115
+ t.string 'nickname'
116
+ t.string 'image'
117
+ t.string 'email'
118
+ t.text 'tokens'
119
+ t.datetime 'created_at'
120
+ t.datetime 'updated_at'
121
+ t.index ['email'], name: 'index_scoped_users_on_email'
122
+ t.index ['reset_password_token'], name: 'index_scoped_users_on_reset_password_token', unique: true
123
+ t.index ['uid', 'provider'], name: 'index_scoped_users_on_uid_and_provider', unique: true
123
124
  end
124
125
 
125
- create_table "unconfirmable_users", force: :cascade do |t|
126
- t.string "provider", null: false
127
- t.string "uid", default: "", null: false
128
- t.string "encrypted_password", default: "", null: false
129
- t.string "reset_password_token"
130
- t.datetime "reset_password_sent_at"
131
- t.boolean "allow_password_change", default: false
132
- t.datetime "remember_created_at"
133
- t.string "name"
134
- t.string "nickname"
135
- t.string "image"
136
- t.string "email"
137
- t.text "tokens"
138
- t.datetime "created_at"
139
- t.datetime "updated_at"
140
- t.index ["email"], name: "index_unconfirmable_users_on_email"
141
- t.index ["reset_password_token"], name: "index_unconfirmable_users_on_reset_password_token", unique: true
142
- t.index ["uid", "provider"], name: "index_unconfirmable_users_on_uid_and_provider", unique: true
126
+ create_table 'unconfirmable_users', force: :cascade do |t|
127
+ t.string 'provider', null: false
128
+ t.string 'uid', default: '', null: false
129
+ t.string 'encrypted_password', default: '', null: false
130
+ t.string 'reset_password_token'
131
+ t.datetime 'reset_password_sent_at'
132
+ t.boolean 'allow_password_change', default: false
133
+ t.datetime 'remember_created_at'
134
+ t.string 'name'
135
+ t.string 'nickname'
136
+ t.string 'image'
137
+ t.string 'email'
138
+ t.text 'tokens'
139
+ t.datetime 'created_at'
140
+ t.datetime 'updated_at'
141
+ t.index ['email'], name: 'index_unconfirmable_users_on_email'
142
+ t.index ['reset_password_token'], name: 'index_unconfirmable_users_on_reset_password_token', unique: true
143
+ t.index ['uid', 'provider'], name: 'index_unconfirmable_users_on_uid_and_provider', unique: true
143
144
  end
144
145
 
145
- create_table "unregisterable_users", force: :cascade do |t|
146
- t.string "provider", null: false
147
- t.string "uid", default: "", null: false
148
- t.string "encrypted_password", default: "", null: false
149
- t.string "reset_password_token"
150
- t.datetime "reset_password_sent_at"
151
- t.boolean "allow_password_change", default: false
152
- t.datetime "remember_created_at"
153
- t.string "confirmation_token"
154
- t.datetime "confirmed_at"
155
- t.datetime "confirmation_sent_at"
156
- t.string "unconfirmed_email"
157
- t.string "name"
158
- t.string "nickname"
159
- t.string "image"
160
- t.string "email"
161
- t.text "tokens"
162
- t.datetime "created_at"
163
- t.datetime "updated_at"
164
- t.index ["email"], name: "index_unregisterable_users_on_email"
165
- t.index ["reset_password_token"], name: "index_unregisterable_users_on_reset_password_token", unique: true
166
- t.index ["uid", "provider"], name: "index_unregisterable_users_on_uid_and_provider", unique: true
146
+ create_table 'unregisterable_users', force: :cascade do |t|
147
+ t.string 'provider', null: false
148
+ t.string 'uid', default: '', null: false
149
+ t.string 'encrypted_password', default: '', null: false
150
+ t.string 'reset_password_token'
151
+ t.datetime 'reset_password_sent_at'
152
+ t.boolean 'allow_password_change', default: false
153
+ t.datetime 'remember_created_at'
154
+ t.string 'confirmation_token'
155
+ t.datetime 'confirmed_at'
156
+ t.datetime 'confirmation_sent_at'
157
+ t.string 'unconfirmed_email'
158
+ t.string 'name'
159
+ t.string 'nickname'
160
+ t.string 'image'
161
+ t.string 'email'
162
+ t.text 'tokens'
163
+ t.datetime 'created_at'
164
+ t.datetime 'updated_at'
165
+ t.index ['email'], name: 'index_unregisterable_users_on_email'
166
+ t.index ['reset_password_token'], name: 'index_unregisterable_users_on_reset_password_token', unique: true
167
+ t.index ['uid', 'provider'], name: 'index_unregisterable_users_on_uid_and_provider', unique: true
167
168
  end
168
169
 
169
- create_table "users", force: :cascade do |t|
170
- t.string "email"
171
- t.string "encrypted_password", default: "", null: false
172
- t.string "reset_password_token"
173
- t.datetime "reset_password_sent_at"
174
- t.string "reset_password_redirect_url"
175
- t.boolean "allow_password_change", default: false
176
- t.datetime "remember_created_at"
177
- t.string "confirmation_token"
178
- t.datetime "confirmed_at"
179
- t.datetime "confirmation_sent_at"
180
- t.string "unconfirmed_email"
181
- t.string "name"
182
- t.string "nickname"
183
- t.string "image"
184
- t.string "provider"
185
- t.string "uid", default: "", null: false
186
- t.text "tokens"
187
- t.datetime "created_at"
188
- t.datetime "updated_at"
189
- t.integer "operating_thetan"
190
- t.string "favorite_color"
191
- t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
192
- t.index ["email"], name: "index_users_on_email"
193
- t.index ["nickname"], name: "index_users_on_nickname", unique: true
194
- t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
195
- t.index ["uid", "provider"], name: "index_users_on_uid_and_provider", unique: true
170
+ create_table 'users', force: :cascade do |t|
171
+ t.string 'email'
172
+ t.string 'encrypted_password', default: '', null: false
173
+ t.string 'reset_password_token'
174
+ t.datetime 'reset_password_sent_at'
175
+ t.string 'reset_password_redirect_url'
176
+ t.boolean 'allow_password_change', default: false
177
+ t.datetime 'remember_created_at'
178
+ t.string 'confirmation_token'
179
+ t.datetime 'confirmed_at'
180
+ t.datetime 'confirmation_sent_at'
181
+ t.string 'unconfirmed_email'
182
+ t.string 'name'
183
+ t.string 'nickname'
184
+ t.string 'image'
185
+ t.string 'provider'
186
+ t.string 'uid', default: '', null: false
187
+ t.text 'tokens'
188
+ t.datetime 'created_at'
189
+ t.datetime 'updated_at'
190
+ t.integer 'operating_thetan'
191
+ t.string 'favorite_color'
192
+ t.index ['confirmation_token'], name: 'index_users_on_confirmation_token', unique: true
193
+ t.index ['email'], name: 'index_users_on_email'
194
+ t.index ['nickname'], name: 'index_users_on_nickname', unique: true
195
+ t.index ['reset_password_token'], name: 'index_users_on_reset_password_token', unique: true
196
+ t.index ['uid', 'provider'], name: 'index_users_on_uid_and_provider', unique: true
196
197
  end
197
-
198
198
  end