graphql_devise 0.18.1 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +25 -2
  3. data/.gitignore +4 -0
  4. data/.rubocop.yml +9 -10
  5. data/Appraisals +72 -35
  6. data/CHANGELOG.md +63 -0
  7. data/README.md +71 -142
  8. data/app/controllers/graphql_devise/graphql_controller.rb +3 -3
  9. data/app/views/graphql_devise/mailer/confirmation_instructions.html.erb +1 -5
  10. data/config/routes.rb +0 -2
  11. data/graphql_devise.gemspec +8 -6
  12. data/lib/generators/graphql_devise/install_generator.rb +1 -1
  13. data/lib/graphql_devise/concerns/additional_controller_methods.rb +48 -0
  14. data/lib/graphql_devise/concerns/additional_model_methods.rb +17 -0
  15. data/lib/graphql_devise/concerns/authenticatable.rb +1 -1
  16. data/lib/graphql_devise/concerns/controller_methods.rb +79 -91
  17. data/lib/graphql_devise/concerns/field_authentication.rb +14 -0
  18. data/lib/graphql_devise/concerns/set_user_by_token.rb +1 -1
  19. data/lib/graphql_devise/default_operations.rb +16 -0
  20. data/lib/graphql_devise/engine.rb +0 -2
  21. data/lib/graphql_devise/model/with_email_updater.rb +5 -30
  22. data/lib/graphql_devise/mount_method/operation_preparer.rb +0 -7
  23. data/lib/graphql_devise/mount_method/operation_preparers/custom_operation_preparer.rb +1 -1
  24. data/lib/graphql_devise/mount_method/operation_preparers/default_operation_preparer.rb +1 -1
  25. data/lib/graphql_devise/mount_method/operation_sanitizer.rb +0 -12
  26. data/lib/graphql_devise/mount_method/option_sanitizer.rb +0 -2
  27. data/lib/graphql_devise/mount_method/option_sanitizers/array_checker.rb +2 -2
  28. data/lib/graphql_devise/mount_method/option_sanitizers/class_checker.rb +2 -2
  29. data/lib/graphql_devise/mount_method/option_sanitizers/hash_checker.rb +1 -1
  30. data/lib/graphql_devise/mount_method/option_sanitizers/string_checker.rb +1 -1
  31. data/lib/graphql_devise/mount_method/option_validators/provided_operations_validator.rb +0 -2
  32. data/lib/graphql_devise/mount_method/option_validators/skip_only_validator.rb +1 -1
  33. data/lib/graphql_devise/mount_method/option_validators/supported_operations_validator.rb +1 -1
  34. data/lib/graphql_devise/mount_method/options_validator.rb +0 -3
  35. data/lib/graphql_devise/mount_method/supported_options.rb +0 -5
  36. data/lib/graphql_devise/mutations/base.rb +1 -1
  37. data/lib/graphql_devise/mutations/confirm_registration_with_token.rb +2 -2
  38. data/lib/graphql_devise/mutations/login.rb +2 -2
  39. data/lib/graphql_devise/mutations/register.rb +2 -2
  40. data/lib/graphql_devise/mutations/update_password_with_token.rb +2 -2
  41. data/lib/graphql_devise/resolvers/base.rb +1 -1
  42. data/lib/graphql_devise/resource_loader.rb +71 -39
  43. data/lib/graphql_devise/route_mounter.rb +13 -0
  44. data/lib/graphql_devise/schema_plugin.rb +11 -40
  45. data/lib/graphql_devise/types/authenticatable_type.rb +1 -1
  46. data/lib/graphql_devise/types/base_field.rb +9 -0
  47. data/lib/graphql_devise/types/base_type.rb +8 -0
  48. data/lib/graphql_devise/types/credential_type.rb +1 -1
  49. data/lib/graphql_devise/types/mutation_type.rb +1 -0
  50. data/lib/graphql_devise/types/query_type.rb +1 -0
  51. data/lib/graphql_devise/version.rb +1 -1
  52. data/lib/graphql_devise.rb +21 -29
  53. data/spec/dummy/app/controllers/api/v1/graphql_controller.rb +2 -16
  54. data/spec/dummy/app/graphql/dummy_schema.rb +1 -5
  55. data/spec/dummy/app/graphql/interpreter_schema.rb +6 -2
  56. data/spec/dummy/app/graphql/mutations/base_mutation.rb +6 -0
  57. data/spec/dummy/app/graphql/mutations/update_user.rb +2 -4
  58. data/spec/dummy/app/graphql/types/admin_type.rb +1 -1
  59. data/spec/dummy/app/graphql/types/custom_admin_type.rb +1 -1
  60. data/spec/dummy/app/graphql/types/mutation_type.rb +3 -1
  61. data/spec/dummy/app/graphql/types/query_type.rb +3 -1
  62. data/spec/dummy/app/graphql/types/user_type.rb +1 -1
  63. data/spec/dummy/config/environments/test.rb +1 -1
  64. data/spec/dummy/config/routes.rb +5 -9
  65. data/spec/generators/graphql_devise/install_generator_spec.rb +2 -2
  66. data/spec/graphql_devise/model/with_email_updater_spec.rb +17 -35
  67. data/spec/rails_helper.rb +5 -5
  68. data/spec/requests/mutations/login_spec.rb +34 -0
  69. data/spec/requests/mutations/resend_confirmation_with_token_spec.rb +2 -3
  70. data/spec/requests/user_controller_spec.rb +1 -33
  71. data/spec/services/resource_loader_spec.rb +53 -3
  72. data/spec/spec_helper.rb +1 -1
  73. metadata +62 -55
  74. data/app/controllers/graphql_devise/concerns/additional_controller_methods.rb +0 -72
  75. data/app/controllers/graphql_devise/concerns/set_user_by_token.rb +0 -21
  76. data/app/helpers/graphql_devise/mailer_helper.rb +0 -37
  77. data/app/models/graphql_devise/concerns/additional_model_methods.rb +0 -21
  78. data/app/models/graphql_devise/concerns/model.rb +0 -25
  79. data/lib/graphql_devise/default_operations/mutations.rb +0 -32
  80. data/lib/graphql_devise/default_operations/resolvers.rb +0 -14
  81. data/lib/graphql_devise/mutations/resend_confirmation.rb +0 -45
  82. data/lib/graphql_devise/mutations/send_password_reset.rb +0 -38
  83. data/lib/graphql_devise/mutations/sign_up.rb +0 -61
  84. data/lib/graphql_devise/mutations/update_password.rb +0 -46
  85. data/lib/graphql_devise/rails/routes.rb +0 -15
  86. data/lib/graphql_devise/resolvers/check_password_token.rb +0 -43
  87. data/lib/graphql_devise/resolvers/confirm_account.rb +0 -42
  88. data/spec/dummy/app/graphql/mutations/sign_up.rb +0 -14
  89. data/spec/dummy/app/graphql/resolvers/confirm_admin_account.rb +0 -13
  90. data/spec/requests/mutations/resend_confirmation_spec.rb +0 -153
  91. data/spec/requests/mutations/send_password_reset_spec.rb +0 -103
  92. data/spec/requests/mutations/sign_up_spec.rb +0 -170
  93. data/spec/requests/mutations/update_password_spec.rb +0 -116
  94. data/spec/requests/queries/check_password_token_spec.rb +0 -149
  95. data/spec/requests/queries/confirm_account_spec.rb +0 -137
@@ -1,122 +1,110 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GraphqlDevise
4
- module Concerns
5
- module ControllerMethods
6
- extend ActiveSupport::Concern
4
+ module ControllerMethods
5
+ extend ActiveSupport::Concern
7
6
 
8
- private
7
+ private
9
8
 
10
- def check_redirect_url_whitelist!(redirect_url)
11
- if blacklisted_redirect_url?(redirect_url)
12
- raise_user_error(I18n.t('graphql_devise.redirect_url_not_allowed', redirect_url: redirect_url))
13
- end
14
- end
15
-
16
- def raise_user_error(message)
17
- raise GraphqlDevise::UserError, message
9
+ def check_redirect_url_whitelist!(redirect_url)
10
+ if blacklisted_redirect_url?(redirect_url)
11
+ raise_user_error(I18n.t('graphql_devise.redirect_url_not_allowed', redirect_url: redirect_url))
18
12
  end
13
+ end
19
14
 
20
- def raise_user_error_list(message, errors:)
21
- raise GraphqlDevise::DetailedUserError.new(message, errors: errors)
22
- end
15
+ def raise_user_error(message)
16
+ raise UserError, message
17
+ end
23
18
 
24
- def remove_resource
25
- controller.resource = nil
26
- controller.client_id = nil
27
- controller.token = nil
28
- end
19
+ def raise_user_error_list(message, errors:)
20
+ raise DetailedUserError.new(message, errors: errors)
21
+ end
29
22
 
30
- def request
31
- controller.request
32
- end
23
+ def remove_resource
24
+ controller.resource = nil
25
+ controller.client_id = nil
26
+ controller.token = nil
27
+ end
33
28
 
34
- def response
35
- controller.response
36
- end
29
+ def response
30
+ controller.response
31
+ end
37
32
 
38
- def controller
39
- context[:controller]
40
- end
33
+ def controller
34
+ context[:controller]
35
+ end
41
36
 
42
- def resource_name
43
- GraphqlDevise.to_mapping_name(resource_class)
44
- end
37
+ def resource_name
38
+ ::GraphqlDevise.to_mapping_name(resource_class)
39
+ end
45
40
 
46
- def resource_class
47
- self.class.instance_variable_get(:@resource_klass)
48
- end
41
+ def resource_class
42
+ self.class.instance_variable_get(:@resource_klass)
43
+ end
49
44
 
50
- def recoverable_enabled?
51
- resource_class.devise_modules.include?(:recoverable)
52
- end
45
+ def recoverable_enabled?
46
+ resource_class.devise_modules.include?(:recoverable)
47
+ end
53
48
 
54
- def confirmable_enabled?
55
- resource_class.devise_modules.include?(:confirmable)
56
- end
49
+ def confirmable_enabled?
50
+ resource_class.devise_modules.include?(:confirmable)
51
+ end
57
52
 
58
- def blacklisted_redirect_url?(redirect_url)
59
- DeviseTokenAuth.redirect_whitelist && !DeviseTokenAuth::Url.whitelisted?(redirect_url)
60
- end
53
+ def blacklisted_redirect_url?(redirect_url)
54
+ DeviseTokenAuth.redirect_whitelist && !DeviseTokenAuth::Url.whitelisted?(redirect_url)
55
+ end
61
56
 
62
- def current_resource
63
- @current_resource ||= controller.send(:set_resource_by_token, resource_class)
64
- end
57
+ def current_resource
58
+ @current_resource ||= controller.send(:set_resource_by_token, resource_class)
59
+ end
65
60
 
66
- def client
67
- if Gem::Version.new(DeviseTokenAuth::VERSION) <= Gem::Version.new('1.1.0')
68
- controller.client_id
69
- else
70
- controller.token.client if controller.token.present?
71
- end
61
+ def client
62
+ if Gem::Version.new(DeviseTokenAuth::VERSION) <= Gem::Version.new('1.1.0')
63
+ controller.client_id
64
+ else
65
+ controller.token.client if controller.token.present?
72
66
  end
67
+ end
73
68
 
74
- def set_auth_headers(resource)
75
- auth_headers = resource.create_new_auth_token
76
- response.headers.merge!(auth_headers)
77
-
78
- auth_headers
79
- end
69
+ def generate_auth_headers(resource)
70
+ auth_headers = resource.create_new_auth_token
71
+ controller.resource = resource
72
+ access_token_name = DeviseTokenAuth.headers_names[:'access-token']
73
+ client_name = DeviseTokenAuth.headers_names[:'client']
80
74
 
81
- def client_and_token(token)
82
- if Gem::Version.new(DeviseTokenAuth::VERSION) <= Gem::Version.new('1.1.0')
83
- { client_id: token.first, token: token.last }
84
- else
85
- { client_id: token.client, token: token.token }
86
- end
75
+ # NOTE: Depending on the DTA version, the token will be an object or nil
76
+ if controller.token
77
+ controller.token.client = auth_headers[client_name]
78
+ controller.token.token = auth_headers[access_token_name]
79
+ else
80
+ controller.client_id = auth_headers[client_name]
81
+ controller.token = auth_headers[access_token_name]
87
82
  end
88
83
 
89
- def redirect_headers(token_info, redirect_header_options)
90
- controller.send(
91
- :build_redirect_headers,
92
- token_info.fetch(:token),
93
- token_info.fetch(:client_id),
94
- redirect_header_options
95
- )
96
- end
84
+ auth_headers
85
+ end
97
86
 
98
- def find_resource(field, value)
99
- if resource_class.connection.adapter_name.downcase.include?('mysql')
100
- # fix for mysql default case insensitivity
101
- resource_class.where("BINARY #{field} = ? AND provider= ?", value, provider).first
102
- elsif Gem::Version.new(DeviseTokenAuth::VERSION) < Gem::Version.new('1.1.0')
103
- resource_class.find_by(field => value, :provider => provider)
104
- else
105
- resource_class.dta_find_by(field => value, :provider => provider)
106
- end
87
+ def find_resource(field, value)
88
+ if resource_class.connection.adapter_name.downcase.include?('mysql')
89
+ # fix for mysql default case insensitivity
90
+ resource_class.where("BINARY #{field} = ? AND provider= ?", value, provider).first
91
+ elsif Gem::Version.new(DeviseTokenAuth::VERSION) < Gem::Version.new('1.1.0')
92
+ resource_class.find_by(field => value, :provider => provider)
93
+ else
94
+ resource_class.dta_find_by(field => value, :provider => provider)
107
95
  end
96
+ end
108
97
 
109
- def get_case_insensitive_field(field, value)
110
- if resource_class.case_insensitive_keys.include?(field)
111
- value.downcase
112
- else
113
- value
114
- end
98
+ def get_case_insensitive_field(field, value)
99
+ if resource_class.case_insensitive_keys.include?(field)
100
+ value.downcase
101
+ else
102
+ value
115
103
  end
104
+ end
116
105
 
117
- def provider
118
- :email
119
- end
106
+ def provider
107
+ :email
120
108
  end
121
109
  end
122
110
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GraphqlDevise
4
+ module FieldAuthentication
5
+ extend ActiveSupport::Concern
6
+
7
+ def initialize(*args, authenticate: nil, **kwargs, &block)
8
+ @authenticate = authenticate
9
+ super(*args, **kwargs, &block)
10
+ end
11
+
12
+ attr_reader :authenticate
13
+ end
14
+ end
@@ -6,7 +6,7 @@ module GraphqlDevise
6
6
 
7
7
  included do
8
8
  include DeviseTokenAuth::Concerns::SetUserByToken
9
- include GraphqlDevise::Concerns::AdditionalControllerMethods
9
+ include AdditionalControllerMethods
10
10
  end
11
11
  end
12
12
  end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GraphqlDevise
4
+ module DefaultOperations
5
+ QUERIES = {}.freeze
6
+ MUTATIONS = {
7
+ login: { klass: Mutations::Login, authenticatable: true },
8
+ logout: { klass: Mutations::Logout, authenticatable: true },
9
+ register: { klass: Mutations::Register, authenticatable: true },
10
+ update_password_with_token: { klass: Mutations::UpdatePasswordWithToken, authenticatable: true },
11
+ send_password_reset_with_token: { klass: Mutations::SendPasswordResetWithToken, authenticatable: false },
12
+ resend_confirmation_with_token: { klass: Mutations::ResendConfirmationWithToken, authenticatable: false },
13
+ confirm_registration_with_token: { klass: Mutations::ConfirmRegistrationWithToken, authenticatable: true }
14
+ }.freeze
15
+ end
16
+ end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'graphql_devise/rails/routes'
4
-
5
3
  module GraphqlDevise
6
4
  class Engine < ::Rails::Engine
7
5
  isolate_namespace GraphqlDevise
@@ -9,15 +9,13 @@ module GraphqlDevise
9
9
  end
10
10
 
11
11
  def call
12
- check_deprecated_attributes
13
-
14
- resource_attributes = @attributes.except(:schema_url, :confirmation_success_url, :confirmation_url)
12
+ resource_attributes = @attributes.except(:confirmation_url)
15
13
  return @resource.update(resource_attributes) unless requires_reconfirmation?(resource_attributes)
16
14
 
17
15
  @resource.assign_attributes(resource_attributes)
18
16
 
19
17
  if @resource.email == email_in_database
20
- return @resource.save
18
+ @resource.save
21
19
  elsif required_reconfirm_attributes?
22
20
  return false unless @resource.valid?
23
21
 
@@ -28,7 +26,7 @@ module GraphqlDevise
28
26
  saved
29
27
  else
30
28
  raise(
31
- GraphqlDevise::Error,
29
+ ::GraphqlDevise::Error,
32
30
  'Method `update_with_email` requires attribute `confirmation_url` for email reconfirmation to work'
33
31
  )
34
32
  end
@@ -36,24 +34,8 @@ module GraphqlDevise
36
34
 
37
35
  private
38
36
 
39
- def check_deprecated_attributes
40
- if [@attributes[:schema_url], @attributes[:confirmation_success_url]].any?(&:present?)
41
- ActiveSupport::Deprecation.warn(<<-DEPRECATION.strip_heredoc, caller)
42
- Providing `schema_url` and `confirmation_success_url` to `update_with_email` is deprecated and will be
43
- removed in a future version of this gem.
44
-
45
- Now you must only provide `confirmation_url` and the email will contain the new format of the confirmation
46
- url that needs to be used with the new `confirmRegistrationWithToken` on the client application.
47
- DEPRECATION
48
- end
49
- end
50
-
51
37
  def required_reconfirm_attributes?
52
- if @attributes[:schema_url].present?
53
- [@attributes[:confirmation_success_url], DeviseTokenAuth.default_confirm_success_url].any?(&:present?)
54
- else
55
- [@attributes[:confirmation_url], DeviseTokenAuth.default_confirm_success_url].any?(&:present?)
56
- end
38
+ [@attributes[:confirmation_url], DeviseTokenAuth.default_confirm_success_url].any?(&:present?)
57
39
  end
58
40
 
59
41
  def requires_reconfirmation?(resource_attributes)
@@ -78,14 +60,7 @@ module GraphqlDevise
78
60
  end
79
61
 
80
62
  def confirmation_method_params
81
- if @attributes[:schema_url].present?
82
- {
83
- redirect_url: @attributes[:confirmation_success_url] || DeviseTokenAuth.default_confirm_success_url,
84
- schema_url: @attributes[:schema_url]
85
- }
86
- else
87
- { redirect_url: @attributes[:confirmation_url] || DeviseTokenAuth.default_confirm_success_url }
88
- end
63
+ { redirect_url: @attributes[:confirmation_url] || DeviseTokenAuth.default_confirm_success_url }
89
64
  end
90
65
 
91
66
  def send_confirmation_instructions(saved)
@@ -1,12 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'operation_preparers/gql_name_setter'
4
- require_relative 'operation_preparers/mutation_field_setter'
5
- require_relative 'operation_preparers/resolver_type_setter'
6
- require_relative 'operation_preparers/resource_klass_setter'
7
- require_relative 'operation_preparers/default_operation_preparer'
8
- require_relative 'operation_preparers/custom_operation_preparer'
9
-
10
3
  module GraphqlDevise
11
4
  module MountMethod
12
5
  class OperationPreparer
@@ -11,7 +11,7 @@ module GraphqlDevise
11
11
  end
12
12
 
13
13
  def call
14
- mapping_name = GraphqlDevise.to_mapping_name(@model)
14
+ mapping_name = ::GraphqlDevise.to_mapping_name(@model)
15
15
 
16
16
  @custom_operations.slice(*@selected_keys).each_with_object({}) do |(action, operation), result|
17
17
  mapped_action = "#{mapping_name}_#{action}"
@@ -12,7 +12,7 @@ module GraphqlDevise
12
12
  end
13
13
 
14
14
  def call
15
- mapping_name = GraphqlDevise.to_mapping_name(@model)
15
+ mapping_name = ::GraphqlDevise.to_mapping_name(@model)
16
16
 
17
17
  @selected_operations.except(*@custom_keys).each_with_object({}) do |(action, operation_info), result|
18
18
  mapped_action = "#{mapping_name}_#{action}"
@@ -25,18 +25,6 @@ module GraphqlDevise
25
25
  else
26
26
  @default
27
27
  end
28
-
29
- operations.each do |operation, values|
30
- next if values[:deprecation_reason].blank?
31
-
32
- ActiveSupport::Deprecation.warn(<<-DEPRECATION.strip_heredoc, caller)
33
- `#{operation}` is deprecated and will be removed in a future version of this gem.
34
- #{values[:deprecation_reason]}
35
-
36
- You can supress this message by skipping `#{operation}` on your ResourceLoader or the
37
- mount_graphql_devise_for method on your routes file.
38
- DEPRECATION
39
- end
40
28
  end
41
29
  end
42
30
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'supported_options'
4
-
5
3
  module GraphqlDevise
6
4
  module MountMethod
7
5
  class OptionSanitizer
@@ -13,11 +13,11 @@ module GraphqlDevise
13
13
  return @default_value if value.blank?
14
14
 
15
15
  unless value.instance_of?(Array)
16
- raise GraphqlDevise::InvalidMountOptionsError, "`#{key}` option has an invalid value. Array expected."
16
+ raise InvalidMountOptionsError, "`#{key}` option has an invalid value. Array expected."
17
17
  end
18
18
 
19
19
  unless value.all? { |element| element.instance_of?(@element_type) }
20
- raise GraphqlDevise::InvalidMountOptionsError, "`#{key}` option has invalid elements. #{@element_type} expected."
20
+ raise InvalidMountOptionsError, "`#{key}` option has invalid elements. #{@element_type} expected."
21
21
  end
22
22
 
23
23
  value
@@ -12,11 +12,11 @@ module GraphqlDevise
12
12
  return if value.nil?
13
13
 
14
14
  unless value.instance_of?(Class)
15
- raise GraphqlDevise::InvalidMountOptionsError, "`#{key}` option has an invalid value. Class expected."
15
+ raise InvalidMountOptionsError, "`#{key}` option has an invalid value. Class expected."
16
16
  end
17
17
 
18
18
  unless @klass_array.any? { |klass| value.ancestors.include?(klass) }
19
- raise GraphqlDevise::InvalidMountOptionsError,
19
+ raise InvalidMountOptionsError,
20
20
  "`#{key}` option has an invalid value. #{@klass_array.join(', ')} or descendants expected. Got #{value}."
21
21
  end
22
22
 
@@ -13,7 +13,7 @@ module GraphqlDevise
13
13
  return @default_value if value.blank?
14
14
 
15
15
  unless value.instance_of?(Hash)
16
- raise GraphqlDevise::InvalidMountOptionsError, "`#{key}` option has an invalid value. Hash expected. Got #{value.class}."
16
+ raise InvalidMountOptionsError, "`#{key}` option has an invalid value. Hash expected. Got #{value.class}."
17
17
  end
18
18
 
19
19
  value.each { |internal_key, klass| ClassChecker.new(@element_type_array).call!(klass, "#{key} -> #{internal_key}") }
@@ -12,7 +12,7 @@ module GraphqlDevise
12
12
  return @default_string if value.blank?
13
13
 
14
14
  unless value.instance_of?(String)
15
- raise GraphqlDevise::InvalidMountOptionsError, "`#{key}` option has an invalid value. String expected."
15
+ raise InvalidMountOptionsError, "`#{key}` option has an invalid value. String expected."
16
16
  end
17
17
 
18
18
  value
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'supported_operations_validator'
4
-
5
3
  module GraphqlDevise
6
4
  module MountMethod
7
5
  module OptionValidators
@@ -11,7 +11,7 @@ module GraphqlDevise
11
11
  def validate!
12
12
  if [@options.skip, @options.only].all?(&:present?)
13
13
  raise(
14
- GraphqlDevise::InvalidMountOptionsError,
14
+ InvalidMountOptionsError,
15
15
  "Can't specify both `skip` and `only` options when mounting the route."
16
16
  )
17
17
  end
@@ -15,7 +15,7 @@ module GraphqlDevise
15
15
 
16
16
  if unsupported_operations.present?
17
17
  raise(
18
- GraphqlDevise::InvalidMountOptionsError,
18
+ InvalidMountOptionsError,
19
19
  "#{@key} option contains unsupported operations: \"#{unsupported_operations.join(', ')}\". Check for typos."
20
20
  )
21
21
  end
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'option_validators/skip_only_validator'
4
- require_relative 'option_validators/provided_operations_validator'
5
-
6
3
  module GraphqlDevise
7
4
  module MountMethod
8
5
  class OptionsValidator
@@ -1,10 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'option_sanitizers/array_checker'
4
- require_relative 'option_sanitizers/hash_checker'
5
- require_relative 'option_sanitizers/string_checker'
6
- require_relative 'option_sanitizers/class_checker'
7
-
8
3
  module GraphqlDevise
9
4
  module MountMethod
10
5
  SUPPORTED_OPTIONS = {
@@ -5,7 +5,7 @@ require 'devise_token_auth/version'
5
5
  module GraphqlDevise
6
6
  module Mutations
7
7
  class Base < GraphQL::Schema::Mutation
8
- include Concerns::ControllerMethods
8
+ include ControllerMethods
9
9
  end
10
10
  end
11
11
  end
@@ -6,7 +6,7 @@ module GraphqlDevise
6
6
  argument :confirmation_token, String, required: true
7
7
 
8
8
  field :credentials,
9
- GraphqlDevise::Types::CredentialType,
9
+ Types::CredentialType,
10
10
  null: true,
11
11
  description: 'Authentication credentials. Null unless user is signed in after confirmation.'
12
12
 
@@ -18,7 +18,7 @@ module GraphqlDevise
18
18
 
19
19
  response_payload = { authenticatable: resource }
20
20
 
21
- response_payload[:credentials] = set_auth_headers(resource) if resource.active_for_authentication?
21
+ response_payload[:credentials] = generate_auth_headers(resource) if resource.active_for_authentication?
22
22
 
23
23
  response_payload
24
24
  else
@@ -6,7 +6,7 @@ module GraphqlDevise
6
6
  argument :email, String, required: true
7
7
  argument :password, String, required: true
8
8
 
9
- field :credentials, GraphqlDevise::Types::CredentialType, null: false
9
+ field :credentials, Types::CredentialType, null: false
10
10
 
11
11
  def resolve(email:, password:)
12
12
  resource = find_resource(
@@ -19,7 +19,7 @@ module GraphqlDevise
19
19
  raise_user_error(I18n.t('graphql_devise.sessions.bad_credentials'))
20
20
  end
21
21
 
22
- new_headers = set_auth_headers(resource)
22
+ new_headers = generate_auth_headers(resource)
23
23
  controller.sign_in(:user, resource, store: false, bypass: false)
24
24
 
25
25
  yield resource if block_given?
@@ -9,7 +9,7 @@ module GraphqlDevise
9
9
  argument :confirm_url, String, required: false
10
10
 
11
11
  field :credentials,
12
- GraphqlDevise::Types::CredentialType,
12
+ Types::CredentialType,
13
13
  null: true,
14
14
  description: 'Authentication credentials. Null if after signUp resource is not active for authentication (e.g. Email confirmation required).'
15
15
 
@@ -38,7 +38,7 @@ module GraphqlDevise
38
38
 
39
39
  response_payload = { authenticatable: resource }
40
40
 
41
- response_payload[:credentials] = set_auth_headers(resource) if resource.active_for_authentication?
41
+ response_payload[:credentials] = generate_auth_headers(resource) if resource.active_for_authentication?
42
42
 
43
43
  response_payload
44
44
  else
@@ -8,7 +8,7 @@ module GraphqlDevise
8
8
  argument :reset_password_token, String, required: true
9
9
 
10
10
  field :credentials,
11
- GraphqlDevise::Types::CredentialType,
11
+ Types::CredentialType,
12
12
  null: true,
13
13
  description: 'Authentication credentials. Resource must be signed_in for credentials to be returned.'
14
14
 
@@ -23,7 +23,7 @@ module GraphqlDevise
23
23
  yield resource if block_given?
24
24
 
25
25
  response_payload = { authenticatable: resource }
26
- response_payload[:credentials] = set_auth_headers(resource) if controller.signed_in?(resource_name)
26
+ response_payload[:credentials] = generate_auth_headers(resource) if controller.signed_in?(resource_name)
27
27
 
28
28
  response_payload
29
29
  else
@@ -5,7 +5,7 @@ require 'devise_token_auth/version'
5
5
  module GraphqlDevise
6
6
  module Resolvers
7
7
  class Base < GraphQL::Schema::Resolver
8
- include Concerns::ControllerMethods
8
+ include ControllerMethods
9
9
  end
10
10
  end
11
11
  end