Skip to content

Commit fbca450

Browse files
committed
Add missing localized messages
1 parent fc508c2 commit fbca450

5 files changed

Lines changed: 20 additions & 15 deletions

File tree

app/graphql/graphql_devise/mutations/login.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def resolve(email:, password:)
2222
if locked?(resource)
2323
raise_user_error(I18n.t('graphql_devise.mailer.unlock_instructions.account_lock_msg'))
2424
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))
2626
end
2727
else
2828
raise_user_error(I18n.t('graphql_devise.sessions.bad_credentials'))

app/graphql/graphql_devise/mutations/resend_confirmation.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@ module Mutations
33
class ResendConfirmation < Base
44
argument :email, String, required: true, prepare: ->(email, _) { email.downcase }
55
argument :redirect_url, String, required: true
6-
6+
77
field :message, String, null: false
8-
8+
99
def resolve(email:, redirect_url:)
1010
resource = controller.find_resource(:uid, email)
1111

1212
if resource
1313
yield resource if block_given?
1414

15-
raise_user_error(I18n.t('errors.messages.already_confirmed')) if resource.confirmed?
15+
raise_user_error(I18n.t('graphql_devise.confirmations.already_confirmed')) if resource.confirmed?
1616

17-
resource.send_confirmation_instructions({
18-
redirect_url: redirect_url,
17+
resource.send_confirmation_instructions(
18+
redirect_url: redirect_url,
1919
template_path: ['graphql_devise/mailer']
20-
})
20+
)
2121

2222
{
2323
authenticable: resource,
24-
message: I18n.t('graphql_devise.confirmations.send_instructions', email: email)
24+
message: I18n.t('graphql_devise.confirmations.send_instructions', email: email)
2525
}
2626
else
2727
raise_user_error(I18n.t('graphql_devise.confirmations.user_not_found', email: email))
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<p><%= t(:welcome).capitalize + ' ' + @email %>!</p>
22

3-
<p><%= t '.confirm_link_msg' %></p>
3+
<p><%= t('.confirm_link_msg') %></p>
44

55
<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>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<p><%= t(:hello).capitalize %> <%= @resource.email %>!</p>
22

3-
<p><%= t '.request_reset_link_msg' %></p>
3+
<p><%= t('.request_reset_link_msg') %></p>
44

55
<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>
66

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>

config/locales/en.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,20 @@ en:
1818
bad_credentials: "Invalid login credentials. Please try again."
1919
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"
2020
confirmations:
21+
already_confirmed: "Email was already confirmed, please try signing in"
2122
invalid_token: "Invalid confirmation token. Please try again"
2223
user_not_found: "Unable to find user with email '%{email}'."
2324
send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
2425
mailer:
2526
confirmation_instructions:
2627
confirm_link_msg: "You can confirm your account email through the link below:"
2728
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."
2834
unlock_instructions:
2935
account_lock_msg: "Your account has been locked due to an excessive number of unsuccessful sign in attempts."
30-
errors:
31-
messages:
32-
already_confirmed: "Email was already confirmed, please try signing in"
36+
hello: "hello"
37+
welcome: "welcome"

0 commit comments

Comments
 (0)