Commit 3f09ab76 authored by Doug Stull's avatar Doug Stull

Redirect to root or back when invite not found

- provide a more friendly user experience instead
  of 404'ing them.
parent e16f9470
......@@ -84,7 +84,7 @@ class InvitesController < ApplicationController
def ensure_member_exists
return if member
render_404
redirect_back_or_default(options: { alert: _("The invitation can not be found with the provided invite token.") })
end
def authenticate_user!
......
---
title: Invalid invite tokens should redirect to the GitLab product
merge_request: 60666
author:
type: other
......@@ -31802,6 +31802,9 @@ msgstr ""
msgid "The interval must be one of %{intervals}."
msgstr ""
msgid "The invitation can not be found with the provided invite token."
msgstr ""
msgid "The invitation could not be accepted."
msgstr ""
......
......@@ -14,10 +14,11 @@ RSpec.describe InvitesController do
context 'when invite token is not valid' do
let(:params) { { id: '_bogus_token_' } }
it 'renders the 404 page' do
it 'redirects to root' do
request
expect(response).to have_gitlab_http_status(:not_found)
expect(response).to redirect_to(root_path)
expect(controller).to set_flash[:alert].to('The invitation can not be found with the provided invite token.')
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment