Skip to content

Commit

Permalink
Merge pull request #23 from o2web/reset-password-details
Browse files Browse the repository at this point in the history
Reset password details
  • Loading branch information
bricesanchez authored Jun 13, 2019
2 parents 7022a69 + 7137156 commit ebca724
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 15 deletions.
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ script:
- bundle exec rake
matrix:
include:
- gemfile: graphql-1.8.gemfile
env: GRAPHQL_RUBY_VERSION=1_8 CI=true
- gemfile: graphql-1.9.gemfile
env: GRAPHQL_RUBY_VERSION=1_9 CI=true
rvm: 2.6.1
- gemfile: graphql-1.8.gemfile
env: GRAPHQL_RUBY_VERSION=1_8 CI=true
- gemfile: graphql-1.9.gemfile
env: GRAPHQL_RUBY_VERSION=1_9 CI=true
rvm: 2.5.3
- gemfile: graphql-1.8.gemfile
env: GRAPHQL_RUBY_VERSION=1_8 CI=true
- gemfile: graphql-1.9.gemfile
env: GRAPHQL_RUBY_VERSION=1_9 CI=true
rvm: 2.4.5
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ gem 'byebug'

gem 'rails', '~> 5.2'

gem 'graphql', '~> 1.8.4'
gem 'graphql', '~> 1.9.6'

# Specify your gem's dependencies in graphql-auth.gemspec
gemspec
13 changes: 8 additions & 5 deletions app/graphql/mutations/auth/reset_password.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@ def resolve(args)
if user.errors.any?
{
success: false,
errors: user.errors.messages.map do |field, messages|
field = field == :reset_password_token ? :_error : field.to_s.camelize(:lower)
errors: user.errors.messages.map { |field, messages|
error_field = field == :reset_password_token ? :_error : field.to_s.camelize(:lower)

{
field: field,
message: messages.first.capitalize }
end
field: error_field,
message: messages.first.capitalize,
details: user.errors.details.dig(field)
}
}
}
else
{
Expand Down
4 changes: 4 additions & 0 deletions app/graphql/types/auth/error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ class Types::Auth::Error < GraphQL::Schema::Object
field :message, String, null: false do
description 'Error message'
end

field :details, GraphQL::Types::JSON, null: true do
description 'Error details'
end
end
2 changes: 1 addition & 1 deletion graphql-1.8.gemfile → graphql-1.9.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ gem 'byebug'
gem 'coveralls'

gem 'rails', '~> 5.2'
gem 'graphql', '~> 1.8.4'
gem 'graphql', '~> 1.9.6'

gemspec
2 changes: 1 addition & 1 deletion graphql-auth.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 2.4.5'

spec.add_dependency "rails", "~> 5.1"
spec.add_dependency 'graphql', '~> 1.8'
spec.add_dependency 'graphql', '~> 1.9', '>= 1.9.6'
spec.add_dependency 'devise', '~> 4.6'
spec.add_dependency 'jwt', '~> 1.5'

Expand Down
2 changes: 1 addition & 1 deletion lib/graphql-auth/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module GraphQL
module Auth
VERSION = '0.4.2'
VERSION = '0.5.0'
end
end

0 comments on commit ebca724

Please sign in to comment.