diff --git a/app/controllers/auth/confirmations_controller.rb b/app/controllers/auth/confirmations_controller.rb index 8f8a480b8..4c8a4746c 100644 --- a/app/controllers/auth/confirmations_controller.rb +++ b/app/controllers/auth/confirmations_controller.rb @@ -11,6 +11,8 @@ class Auth::ConfirmationsController < Devise::ConfirmationsController else respond_with_navigational(resource) { redirect_to after_confirmation_path_for(resource_name, resource) } end + elsif resource.errors.map(&:type).include?(:confirmation_period_expired) + render "devise/confirmations/expired" else respond_with_navigational(resource.errors, status: :unprocessable_entity) { render :new } end diff --git a/app/views/devise/confirmations/expired.html.erb b/app/views/devise/confirmations/expired.html.erb new file mode 100644 index 000000000..c33ec226c --- /dev/null +++ b/app/views/devise/confirmations/expired.html.erb @@ -0,0 +1,11 @@ +<% content_for :title, "Your invitation link has expired" %> + +
+
+

+ <%= content_for(:title) %> +

+ +

Contact your coordinator to request a new one.

+
+
diff --git a/spec/requests/auth/confirmations_controller_spec.rb b/spec/requests/auth/confirmations_controller_spec.rb index c6264f24f..1cecf0447 100644 --- a/spec/requests/auth/confirmations_controller_spec.rb +++ b/spec/requests/auth/confirmations_controller_spec.rb @@ -39,10 +39,8 @@ RSpec.describe Auth::ConfirmationsController, type: :request do get "/account/confirmation?confirmation_token=#{user.confirmation_token}" end - it "shows the Resend Invitation page" do - expect(page).to have_selector("#error-summary-title") - expect(page).to have_content(I18n.t("errors.messages.confirmation_period_expired", period:)) - expect(page).to have_content("Resend invitation link") + it "shows the error page" do + expect(page).to have_content("Your invitation link has expired") end end end