devise_token_auth 1.1.0 → 1.1.1

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.

Potentially problematic release.


This version of devise_token_auth might be problematic. Click here for more details.

Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -0
  3. data/app/controllers/devise_token_auth/concerns/set_user_by_token.rb +26 -29
  4. data/app/controllers/devise_token_auth/confirmations_controller.rb +54 -7
  5. data/app/controllers/devise_token_auth/omniauth_callbacks_controller.rb +7 -7
  6. data/app/controllers/devise_token_auth/passwords_controller.rb +4 -4
  7. data/app/controllers/devise_token_auth/registrations_controller.rb +2 -2
  8. data/app/controllers/devise_token_auth/sessions_controller.rb +5 -5
  9. data/app/controllers/devise_token_auth/unlocks_controller.rb +3 -3
  10. data/app/models/devise_token_auth/concerns/active_record_support.rb +3 -21
  11. data/app/models/devise_token_auth/concerns/tokens_serialization.rb +19 -0
  12. data/app/models/devise_token_auth/concerns/user.rb +36 -45
  13. data/app/models/devise_token_auth/concerns/user_omniauth_callbacks.rb +1 -1
  14. data/app/validators/{devise_token_auth/email_validator.rb → devise_token_auth_email_validator.rb} +1 -1
  15. data/config/locales/en.yml +5 -0
  16. data/lib/devise_token_auth.rb +1 -0
  17. data/lib/devise_token_auth/engine.rb +2 -0
  18. data/lib/devise_token_auth/rails/routes.rb +1 -1
  19. data/lib/devise_token_auth/token_factory.rb +126 -0
  20. data/lib/devise_token_auth/version.rb +1 -1
  21. data/lib/generators/devise_token_auth/templates/devise_token_auth.rb +5 -0
  22. data/test/controllers/demo_user_controller_test.rb +2 -2
  23. data/test/controllers/devise_token_auth/confirmations_controller_test.rb +39 -0
  24. data/test/dummy/app/controllers/overrides/confirmations_controller.rb +3 -3
  25. data/test/dummy/app/controllers/overrides/passwords_controller.rb +3 -3
  26. data/test/dummy/app/controllers/overrides/registrations_controller.rb +1 -1
  27. data/test/dummy/app/controllers/overrides/sessions_controller.rb +1 -1
  28. data/test/dummy/config/initializers/devise.rb +275 -2
  29. data/test/dummy/config/initializers/devise_token_auth.rb +35 -4
  30. data/test/dummy/tmp/generators/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  31. data/test/dummy/tmp/generators/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  32. data/test/factories/users.rb +1 -1
  33. data/test/lib/devise_token_auth/token_factory_test.rb +191 -0
  34. data/test/models/concerns/tokens_serialization_test.rb +70 -0
  35. data/test/models/user_test.rb +0 -32
  36. metadata +29 -13
  37. data/test/dummy/tmp/generators/app/models/azpire/v1/human_resource/user.rb +0 -9
  38. data/test/dummy/tmp/generators/config/initializers/devise_token_auth.rb +0 -50
  39. data/test/dummy/tmp/generators/config/routes.rb +0 -4
  40. data/test/dummy/tmp/generators/db/migrate/20190112150327_devise_token_auth_create_azpire_v1_human_resource_users.rb +0 -56
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class Azpire::V1::HumanResource::User < ActiveRecord::Base
4
- # Include default devise modules. Others available are:
5
- # :confirmable, :lockable, :timeoutable and :omniauthable
6
- devise :database_authenticatable, :registerable,
7
- :recoverable, :rememberable, :trackable, :validatable
8
- include DeviseTokenAuth::Concerns::User
9
- end
@@ -1,50 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- DeviseTokenAuth.setup do |config|
4
- # By default the authorization headers will change after each request. The
5
- # client is responsible for keeping track of the changing tokens. Change
6
- # this to false to prevent the Authorization header from changing after
7
- # each request.
8
- # config.change_headers_on_each_request = true
9
-
10
- # By default, users will need to re-authenticate after 2 weeks. This setting
11
- # determines how long tokens will remain valid after they are issued.
12
- # config.token_lifespan = 2.weeks
13
-
14
- # Sets the max number of concurrent devices per user, which is 10 by default.
15
- # After this limit is reached, the oldest tokens will be removed.
16
- # config.max_number_of_devices = 10
17
-
18
- # Sometimes it's necessary to make several requests to the API at the same
19
- # time. In this case, each request in the batch will need to share the same
20
- # auth token. This setting determines how far apart the requests can be while
21
- # still using the same auth token.
22
- # config.batch_request_buffer_throttle = 5.seconds
23
-
24
- # This route will be the prefix for all oauth2 redirect callbacks. For
25
- # example, using the default '/omniauth', the github oauth2 provider will
26
- # redirect successful authentications to '/omniauth/github/callback'
27
- # config.omniauth_prefix = "/omniauth"
28
-
29
- # By default sending current password is not needed for the password update.
30
- # Uncomment to enforce current_password param to be checked before all
31
- # attribute updates. Set it to :password if you want it to be checked only if
32
- # password is updated.
33
- # config.check_current_password_before_update = :attributes
34
-
35
- # By default we will use callbacks for single omniauth.
36
- # It depends on fields like email, provider and uid.
37
- # config.default_callbacks = true
38
-
39
- # Makes it possible to change the headers names
40
- # config.headers_names = {:'access-token' => 'access-token',
41
- # :'client' => 'client',
42
- # :'expiry' => 'expiry',
43
- # :'uid' => 'uid',
44
- # :'token-type' => 'token-type' }
45
-
46
- # By default, only Bearer Token authentication is implemented out of the box.
47
- # If, however, you wish to integrate with legacy Devise authentication, you can
48
- # do so by enabling this flag. NOTE: This feature is highly experimental!
49
- # config.enable_standard_devise_support = false
50
- end
@@ -1,4 +0,0 @@
1
- Rails.application.routes.draw do
2
- mount_devise_token_auth_for 'Azpire::V1::HumanResource::User', at: 'auth'
3
- patch '/chong', to: 'bong#index'
4
- end
@@ -1,56 +0,0 @@
1
- class DeviseTokenAuthCreateAzpireV1HumanResourceUsers < ActiveRecord::Migration[5.2]
2
- def change
3
-
4
- create_table(:azpire_v1_human_resource_users) do |t|
5
- ## Required
6
- t.string :provider, :null => false, :default => "email"
7
- t.string :uid, :null => false, :default => ""
8
-
9
- ## Database authenticatable
10
- t.string :encrypted_password, :null => false, :default => ""
11
-
12
- ## Recoverable
13
- t.string :reset_password_token
14
- t.datetime :reset_password_sent_at
15
- t.boolean :allow_password_change, :default => false
16
-
17
- ## Rememberable
18
- t.datetime :remember_created_at
19
-
20
- ## Trackable
21
- t.integer :sign_in_count, :default => 0, :null => false
22
- t.datetime :current_sign_in_at
23
- t.datetime :last_sign_in_at
24
- t.string :current_sign_in_ip
25
- t.string :last_sign_in_ip
26
-
27
- ## Confirmable
28
- t.string :confirmation_token
29
- t.datetime :confirmed_at
30
- t.datetime :confirmation_sent_at
31
- t.string :unconfirmed_email # Only if using reconfirmable
32
-
33
- ## Lockable
34
- # t.integer :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
35
- # t.string :unlock_token # Only if unlock strategy is :email or :both
36
- # t.datetime :locked_at
37
-
38
- ## User Info
39
- t.string :name
40
- t.string :nickname
41
- t.string :image
42
- t.string :email
43
-
44
- ## Tokens
45
- t.text :tokens
46
-
47
- t.timestamps
48
- end
49
-
50
- add_index :azpire_v1_human_resource_users, :email, unique: true
51
- add_index :azpire_v1_human_resource_users, [:uid, :provider], unique: true
52
- add_index :azpire_v1_human_resource_users, :reset_password_token, unique: true
53
- add_index :azpire_v1_human_resource_users, :confirmation_token, unique: true
54
- # add_index :azpire_v1_human_resource_users, :unlock_token, unique: true
55
- end
56
- end