diff --git a/app/controllers/invites_controller.rb b/app/controllers/invites_controller.rb index a178e401da..884f67ec8f 100644 --- a/app/controllers/invites_controller.rb +++ b/app/controllers/invites_controller.rb @@ -63,7 +63,8 @@ class InvitesController < ApplicationController rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotSaved => e render json: { success: false, - errors: e.record&.errors&.to_hash || {} + errors: e.record&.errors&.to_hash || {}, + message: I18n.t('invite.error_message') } end else diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 286a8f2553..c525fe1f90 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -208,6 +208,7 @@ en:
If you remember your password you can Login.
Otherwise please Reset Password.
+ error_message: "There was an error accepting invite. Please contact the site's administrator." user_exists: "There's no need to invite %{email}, they already have an account!" confirm_email: "You’re almost done! We sent an activation mail to your email address. Please follow the instructions in the mail to activate your account.
If it doesn’t arrive, check your spam folder.
" diff --git a/spec/requests/invites_controller_spec.rb b/spec/requests/invites_controller_spec.rb index 037d2aa047..b2b7f4152c 100644 --- a/spec/requests/invites_controller_spec.rb +++ b/spec/requests/invites_controller_spec.rb @@ -213,6 +213,18 @@ describe InvitesController do end end + context 'with an invalid invite record' do + let(:invite) { Fabricate(:invite, email: "John Doe