Skip to content
Snippets Groups Projects
Unverified Commit f8626780 authored by Ahmad Farhat's avatar Ahmad Farhat Committed by GitHub
Browse files

Fix room redirect not working for legacy links (#5293)

parent 689e7643
No related branches found
No related tags found
No related merge requests found
......@@ -65,7 +65,7 @@ class ExternalController < ApplicationController
redirect_location = cookies.delete(:location)
return redirect_to redirect_location, allow_other_host: false if redirect_location&.match?('\/rooms\/\w{3}-\w{3}-\w{3}-\w{3}\/join\z')
return redirect_to redirect_location, allow_other_host: false if redirect_location&.match?('\/rooms\/\w{3}-\w{3}-\w{3}(-\w{3})?\/join\z')
redirect_to root_path
rescue ActionController::Redirecting::UnsafeRedirectError => e
......
......@@ -86,6 +86,18 @@ RSpec.describe ExternalController, type: :controller do
expect(response).to redirect_to('/rooms/o5g-hvb-s44-p5t/join')
end
it 'redirects to the location cookie if its a legacy url (3 sections in uid)' do
request.env['omniauth.auth'] = OmniAuth.config.mock_auth[:openid_connect]
cookies[:location] = {
value: '/rooms/o5g-hvb-s44/join',
path: '/'
}
get :create_user, params: { provider: 'openid_connect' }
expect(response).to redirect_to('/rooms/o5g-hvb-s44/join')
end
it 'redirects to the location cookie if a relative redirection 2' do
request.env['omniauth.auth'] = OmniAuth.config.mock_auth[:openid_connect]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment