graphql_devise 0.6.0 → 0.7.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2f7dfece709cd21b9fcd43462bac6a9b428f3f264e75b6deb7b7f68e87265c5c
4
- data.tar.gz: 4b6a0b5f9b1432c1099db7616b71198ffc1f55fcbeb9a887f2abc40a20555017
3
+ metadata.gz: e14199edb2f13b7bc5998a9b56895559f24a823e0764b81fa6e3d9f30baabe63
4
+ data.tar.gz: bb649528f0e55edac087bb29badd8a849a17c4904fdd3804509cdbdcdc803ea8
5
5
  SHA512:
6
- metadata.gz: ddac5d5d55ab2fb997715d5dca89fc9e764d157d52a7b820c4b7a954108c24c6c981cfa981b76e0a6a23cf343bd1b68d3aa8cb112d9482be6f0875e3186c6c20
7
- data.tar.gz: 97ea9fe517b9ab192b44da932810fb850eb90ba45168ee932f8d4969c89b6827cc80bc95b46f8ccaa45d8023e6c036c1df062d29c75503300661a39009490c56
6
+ metadata.gz: 9446b37c593b01f806e426d6b23d596a3c043daafecc5410876db20369831484c734c9916bd2df124409e6081d7d2a3c28adbe4feed456541558d2ac8260f3b1
7
+ data.tar.gz: 0dc4c8c206fd10d5de9c3247f72cac7d40f9374e085e641c3d8e57259fa1d7fb587dd4d1e5f8c36045d7fb10954cbc538f9ef80b0b45becaa56adafd2e184903
@@ -0,0 +1,81 @@
1
+ ---
2
+ name: Bug report
3
+ about: Report a bug in the gem
4
+ labels: 'issue: bug, needs triage'
5
+ ---
6
+
7
+ <!--
8
+ Please use this template and fill in as many fields below as you can.
9
+ The more details you give us on the problem, the more likely we will be able to help.
10
+ -->
11
+
12
+ ### Describe the bug
13
+
14
+ (Describe the problem you are experiencing here.)
15
+
16
+ ### Environment
17
+
18
+ <!--
19
+ To help identify if a problem is specific to a platform, gem version or dependencies version, we will need you Gemfile and Gemfile.lock. Please paste the links to these files or a gist of their content.
20
+ -->
21
+
22
+ (paste the link(s) to the Gemfile and Gemfile.lock files.)
23
+
24
+ ### Steps to reproduce
25
+
26
+ <!--
27
+ How would you describe your issue to someone who doesn’t know you or your project?
28
+ Try to write a sequence of steps that anybody can repeat to see the issue.
29
+ -->
30
+
31
+ (Write your steps here:)
32
+
33
+ 1.
34
+ 2.
35
+ 3.
36
+
37
+ ### Expected behavior
38
+
39
+ <!--
40
+ How did you expect the tool to behave?
41
+ It’s fine if you’re not sure your understanding is correct.
42
+ Just write down what you thought would happen.
43
+ -->
44
+
45
+ (Write what you thought would happen.)
46
+
47
+ ### Actual behavior
48
+
49
+ <!--
50
+ Did something go wrong?
51
+ Is something broken, or not behaving as you expected?
52
+ Please attach relevant stacktraces or query/mutation responses when possible. They are very helplful.
53
+ -->
54
+
55
+ (Write what happened. Please add stacktraces or http responses!)
56
+
57
+ ### Reproducible demo
58
+
59
+ <!--
60
+ If you can, please share a project that reproduces the issue.
61
+ For this you can :
62
+
63
+ * Create a new rails app
64
+ * Add the gem version in the Gemfile
65
+ * Try to reproduce the issue in it.
66
+
67
+ Another possibility is to copy your app and remove all the things you don't want to be public.
68
+ -->
69
+
70
+ (Paste the link to an example project and exact instructions to reproduce the issue.)
71
+
72
+ <!--
73
+ What happens if you skip this step?
74
+
75
+ We will try to help you, but in many cases it is impossible because crucial
76
+ information is missing. In that case we'll tag an issue as having a low priority,
77
+ and eventually close it if there is no clear direction.
78
+
79
+ We still appreciate the report though, as eventually somebody else might
80
+ create a reproducible example for it.
81
+ -->
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: Enhancement
3
+ about: Suggest an idea for improving the gem
4
+ labels: 'issue: enhancement'
5
+ ---
6
+
7
+ ### What is the problem the enhancement will solve?
8
+
9
+ <!--
10
+ Describe the problem you are facing.
11
+ -->
12
+
13
+ (Write the problem here.)
14
+
15
+ ### Describe the solution you have in mind
16
+
17
+ <!--
18
+ Provide a clear and concise description of the enhancement.
19
+ Links to similar solutions that already exists can be helpful.
20
+ -->
21
+
22
+ (Describe your proposed solution here.)
23
+
24
+ ### Describe alternatives you've considered
25
+
26
+ <!--
27
+ Let us know about other solutions you've tried or researched.
28
+ -->
29
+
30
+ (Write your findings here.)
31
+
32
+ ### Additional context
33
+
34
+ <!--
35
+ You can add related issues here.
36
+ -->
37
+
38
+ (Write your answer here.)
@@ -0,0 +1,16 @@
1
+ ---
2
+ name: Question
3
+ about: Inquiries about the gem
4
+ labels: 'issue: question'
5
+ ---
6
+ <!--
7
+ If you have a general question about the gem feel free to post it here.
8
+ -->
9
+
10
+ ### Question
11
+
12
+ <!--
13
+ Write tour question.
14
+ -->
15
+
16
+ (Write your question here.)
data/CHANGELOG.md CHANGED
@@ -1,6 +1,18 @@
1
1
  # Changelog
2
2
 
3
- ## [v0.6.0](https://github.com/graphql-devise/graphql_devise/tree/v0.6.0) (2019-10-29)
3
+ ## [v0.7.0](https://github.com/graphql-devise/graphql_devise/tree/v0.7.0) (2019-11-25)
4
+
5
+ [Full Changelog](https://github.com/graphql-devise/graphql_devise/compare/v0.6.0...v0.7.0)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Added ResendConfirmation GraphQL method. [\#35](https://github.com/graphql-devise/graphql_devise/pull/35) ([aarona](https://github.com/aarona))
10
+
11
+ **Fixed bugs:**
12
+
13
+ - Add missing localized messages [\#41](https://github.com/graphql-devise/graphql_devise/pull/41) ([mcelicalderon](https://github.com/mcelicalderon))
14
+
15
+ ## [v0.6.0](https://github.com/graphql-devise/graphql_devise/tree/v0.6.0) (2019-10-30)
4
16
 
5
17
  [Full Changelog](https://github.com/graphql-devise/graphql_devise/compare/v0.5.0...v0.6.0)
6
18
 
data/README.md CHANGED
@@ -156,19 +156,25 @@ The install generator can do this for you because it executes DTA installer.
156
156
  See [Installation](#Installation) for details.
157
157
 
158
158
  ### Making Requests
159
- Here is a list of the available mutations and queries assuming your mounted model
160
- is `User`.
159
+ Here is a list of the available mutations and queries assuming your mounted model is `User`.
161
160
 
162
161
  #### Mutations
163
- 1. userLogin
164
- 1. userLogout
165
- 1. userSignUp
166
- 1. userUpdatePassword
167
- 1. userSendPasswordReset
162
+ 1. `userLogin(email: String!, password: String!): UserLoginPayload`
163
+ 1. `userLogout: UserLogoutPayload`
164
+ 1. `userSignUp(email: String!, password: String!, passwordConfirmation: String!, confirmSuccessUrl: String): UserSignUpPayload`
165
+
166
+ The parameter `confirmSuccessUrl` is optional unless you are using the `confirmable` plugin from Devise in your `resource`'s model. If you have `confirmable` set up, you will have to provide it unless you have `config.default_confirm_success_url` set in `config/initializers/devise_token_auth.rb`.
167
+ 1. `userUpdatePassword(password: String!, passwordConfirmation: String!, currentPassword: String): UserUpdatePasswordPayload`
168
+
169
+ The parameter `currentPassword` is optional if you have `config.check_current_password_before_update` set to false (disabled by default) or the `resource` model supports the `recoverable` Devise plugin and the `resource`'s `allow_password_change` attribute is set to true.
170
+ 1. `userSendResetPassword(email: String!, redirectUrl: String!): UserSendReserPasswordPayload`
171
+ 1. `userResendConfirmation(email: String!, redirectUrl: String!): UserResendConfirmationPayload`
172
+
173
+ The `UserResendConfirmationPayload` will return the `authenticable` resource that was sent the confirmation instructions but also has a `message: String!` that can be used to notify a user what to do after the instructions were sent to them
168
174
 
169
175
  #### Queries
170
- 1. userConfirmAccount
171
- 1. userCheckPasswordToken
176
+ 1. `userConfirmAccount(confirmationToken: String!, redirectUrl: String!): User`
177
+ 1. `userCheckPasswordToken(resetPasswordToken: String!, redirectUrl: String): User`
172
178
 
173
179
  The reason for having 2 queries is that these 2 are going to be accessed when clicking on
174
180
  the confirmation and reset password email urls. There is no limitation for making mutation
@@ -22,7 +22,7 @@ module GraphqlDevise
22
22
  if locked?(resource)
23
23
  raise_user_error(I18n.t('graphql_devise.mailer.unlock_instructions.account_lock_msg'))
24
24
  else
25
- raise_user_error(I18n.t('devise_token_auth.sessions.not_confirmed', email: resource.email))
25
+ raise_user_error(I18n.t('graphql_devise.sessions.not_confirmed', email: resource.email))
26
26
  end
27
27
  else
28
28
  raise_user_error(I18n.t('graphql_devise.sessions.bad_credentials'))
@@ -0,0 +1,32 @@
1
+ module GraphqlDevise
2
+ module Mutations
3
+ class ResendConfirmation < Base
4
+ argument :email, String, required: true, prepare: ->(email, _) { email.downcase }
5
+ argument :redirect_url, String, required: true
6
+
7
+ field :message, String, null: false
8
+
9
+ def resolve(email:, redirect_url:)
10
+ resource = controller.find_resource(:uid, email)
11
+
12
+ if resource
13
+ yield resource if block_given?
14
+
15
+ raise_user_error(I18n.t('graphql_devise.confirmations.already_confirmed')) if resource.confirmed?
16
+
17
+ resource.send_confirmation_instructions(
18
+ redirect_url: redirect_url,
19
+ template_path: ['graphql_devise/mailer']
20
+ )
21
+
22
+ {
23
+ authenticable: resource,
24
+ message: I18n.t('graphql_devise.confirmations.send_instructions', email: email)
25
+ }
26
+ else
27
+ raise_user_error(I18n.t('graphql_devise.confirmations.user_not_found', email: email))
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -1,5 +1,5 @@
1
1
  <p><%= t(:welcome).capitalize + ' ' + @email %>!</p>
2
2
 
3
- <p><%= t '.confirm_link_msg' %> </p>
3
+ <p><%= t('.confirm_link_msg') %></p>
4
4
 
5
5
  <p><%= link_to t('.confirm_account_link'), url_for(controller: 'graphql_devise/graphql', action: :auth, **confirmation_query(resource_name: @resource.class.to_s, redirect_url: message['redirect-url'], token: @token)) %></p>
@@ -1,8 +1,8 @@
1
1
  <p><%= t(:hello).capitalize %> <%= @resource.email %>!</p>
2
2
 
3
- <p><%= t '.request_reset_link_msg' %></p>
3
+ <p><%= t('.request_reset_link_msg') %></p>
4
4
 
5
5
  <p><%= link_to t('.password_change_link'), url_for(controller: 'graphql_devise/graphql', action: :auth, **password_reset_query(token: @token, redirect_url: message['redirect-url'], resource_name: @resource.class.to_s)) %></p>
6
6
 
7
- <p><%= t '.ignore_mail_msg' %></p>
8
- <p><%= t '.no_changes_msg' %></p>
7
+ <p><%= t('.ignore_mail_msg') %></p>
8
+ <p><%= t('.no_changes_msg') %></p>
@@ -18,7 +18,20 @@ en:
18
18
  bad_credentials: "Invalid login credentials. Please try again."
19
19
  not_confirmed: "A confirmation email was sent to your account at '%{email}'. You must follow the instructions in the email before your account can be activated"
20
20
  confirmations:
21
+ already_confirmed: "Email was already confirmed, please try signing in"
21
22
  invalid_token: "Invalid confirmation token. Please try again"
23
+ user_not_found: "Unable to find user with email '%{email}'."
24
+ send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
22
25
  mailer:
26
+ confirmation_instructions:
27
+ confirm_link_msg: "You can confirm your account email through the link below:"
28
+ confirm_account_link: "Confirm my account"
29
+ reset_password_instructions:
30
+ request_reset_link_msg: "Someone has requested a link to change your password. You can do this through the link below."
31
+ password_change_link: "Change my password"
32
+ ignore_mail_msg: "If you didn't request this, please ignore this email."
33
+ no_changes_msg: "Your password won't change until you access the link above and create a new one."
23
34
  unlock_instructions:
24
35
  account_lock_msg: "Your account has been locked due to an excessive number of unsuccessful sign in attempts."
36
+ hello: "hello"
37
+ welcome: "welcome"
@@ -14,7 +14,8 @@ module ActionDispatch::Routing
14
14
  logout: GraphqlDevise::Mutations::Logout,
15
15
  sign_up: GraphqlDevise::Mutations::SignUp,
16
16
  update_password: GraphqlDevise::Mutations::UpdatePassword,
17
- send_password_reset: GraphqlDevise::Mutations::SendPasswordReset
17
+ send_password_reset: GraphqlDevise::Mutations::SendPasswordReset,
18
+ resend_confirmation: GraphqlDevise::Mutations::ResendConfirmation
18
19
  }.freeze
19
20
  default_queries = {
20
21
  confirm_account: GraphqlDevise::Resolvers::ConfirmAccount,
@@ -1,3 +1,3 @@
1
1
  module GraphqlDevise
2
- VERSION = '0.6.0'.freeze
2
+ VERSION = '0.7.0'.freeze
3
3
  end
@@ -41,5 +41,5 @@ Rails.application.configure do
41
41
  config.active_support.deprecation = :stderr
42
42
 
43
43
  # Raises error for missing translations
44
- # config.action_view.raise_on_missing_translations = true
44
+ config.action_view.raise_on_missing_translations = true
45
45
  end
@@ -0,0 +1,3 @@
1
+ I18n.exception_handler = lambda do |exception, locale, key, options|
2
+ raise exception
3
+ end