mirror of
https://github.com/discourse/discourse.git
synced 2025-02-07 09:09:44 +08:00
DEV: Remove fsl
cookie from specs (#13657)
This cookie has not been used for a number of years, and has no effect. This commit removes it from the specs. (diff is almost entirely whitespace)
This commit is contained in:
parent
968ec4f2af
commit
a1e5a6bbe0
|
@ -600,108 +600,98 @@ RSpec.describe Users::OmniauthCallbacksController do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with full screen login' do
|
it "doesn't attempt redirect to external origin" do
|
||||||
before do
|
post "/auth/google_oauth2?origin=https://example.com/external"
|
||||||
cookies['fsl'] = true
|
get "/auth/google_oauth2/callback"
|
||||||
end
|
|
||||||
|
|
||||||
it "doesn't attempt redirect to external origin" do
|
expect(response.status).to eq 302
|
||||||
post "/auth/google_oauth2?origin=https://example.com/external"
|
expect(response.location).to eq "http://test.localhost/"
|
||||||
get "/auth/google_oauth2/callback"
|
|
||||||
|
|
||||||
expect(response.status).to eq 302
|
cookie_data = JSON.parse(response.cookies['authentication_data'])
|
||||||
expect(response.location).to eq "http://test.localhost/"
|
expect(cookie_data["destination_url"]).to eq('/')
|
||||||
|
end
|
||||||
|
|
||||||
cookie_data = JSON.parse(response.cookies['authentication_data'])
|
it "redirects to internal origin" do
|
||||||
expect(cookie_data["destination_url"]).to eq('/')
|
post "/auth/google_oauth2?origin=http://test.localhost/t/123"
|
||||||
end
|
get "/auth/google_oauth2/callback"
|
||||||
|
|
||||||
it "redirects to internal origin" do
|
expect(response.status).to eq 302
|
||||||
post "/auth/google_oauth2?origin=http://test.localhost/t/123"
|
expect(response.location).to eq "http://test.localhost/t/123"
|
||||||
get "/auth/google_oauth2/callback"
|
|
||||||
|
|
||||||
expect(response.status).to eq 302
|
cookie_data = JSON.parse(response.cookies['authentication_data'])
|
||||||
expect(response.location).to eq "http://test.localhost/t/123"
|
expect(cookie_data["destination_url"]).to eq('/t/123')
|
||||||
|
end
|
||||||
|
|
||||||
cookie_data = JSON.parse(response.cookies['authentication_data'])
|
it "redirects to internal origin on subfolder" do
|
||||||
expect(cookie_data["destination_url"]).to eq('/t/123')
|
set_subfolder "/subpath"
|
||||||
end
|
|
||||||
|
|
||||||
it "redirects to internal origin on subfolder" do
|
post "/auth/google_oauth2?origin=http://test.localhost/subpath/t/123"
|
||||||
set_subfolder "/subpath"
|
get "/auth/google_oauth2/callback"
|
||||||
|
|
||||||
post "/auth/google_oauth2?origin=http://test.localhost/subpath/t/123"
|
expect(response.status).to eq 302
|
||||||
get "/auth/google_oauth2/callback"
|
expect(response.location).to eq "http://test.localhost/subpath/t/123"
|
||||||
|
|
||||||
expect(response.status).to eq 302
|
cookie_data = JSON.parse(response.cookies['authentication_data'])
|
||||||
expect(response.location).to eq "http://test.localhost/subpath/t/123"
|
expect(cookie_data["destination_url"]).to eq('/subpath/t/123')
|
||||||
|
end
|
||||||
|
|
||||||
cookie_data = JSON.parse(response.cookies['authentication_data'])
|
it "never redirects to /auth/ origin" do
|
||||||
expect(cookie_data["destination_url"]).to eq('/subpath/t/123')
|
post "/auth/google_oauth2?origin=http://test.localhost/auth/google_oauth2"
|
||||||
end
|
get "/auth/google_oauth2/callback"
|
||||||
|
|
||||||
it "never redirects to /auth/ origin" do
|
expect(response.status).to eq 302
|
||||||
post "/auth/google_oauth2?origin=http://test.localhost/auth/google_oauth2"
|
expect(response.location).to eq "http://test.localhost/"
|
||||||
get "/auth/google_oauth2/callback"
|
|
||||||
|
|
||||||
expect(response.status).to eq 302
|
cookie_data = JSON.parse(response.cookies['authentication_data'])
|
||||||
expect(response.location).to eq "http://test.localhost/"
|
expect(cookie_data["destination_url"]).to eq('/')
|
||||||
|
end
|
||||||
|
|
||||||
cookie_data = JSON.parse(response.cookies['authentication_data'])
|
it "never redirects to /auth/ origin on subfolder" do
|
||||||
expect(cookie_data["destination_url"]).to eq('/')
|
set_subfolder "/subpath"
|
||||||
end
|
|
||||||
|
|
||||||
it "never redirects to /auth/ origin on subfolder" do
|
post "/auth/google_oauth2?origin=http://test.localhost/subpath/auth/google_oauth2"
|
||||||
set_subfolder "/subpath"
|
get "/auth/google_oauth2/callback"
|
||||||
|
|
||||||
post "/auth/google_oauth2?origin=http://test.localhost/subpath/auth/google_oauth2"
|
expect(response.status).to eq 302
|
||||||
get "/auth/google_oauth2/callback"
|
expect(response.location).to eq "http://test.localhost/subpath"
|
||||||
|
|
||||||
expect(response.status).to eq 302
|
cookie_data = JSON.parse(response.cookies['authentication_data'])
|
||||||
expect(response.location).to eq "http://test.localhost/subpath"
|
expect(cookie_data["destination_url"]).to eq('/subpath')
|
||||||
|
end
|
||||||
|
|
||||||
cookie_data = JSON.parse(response.cookies['authentication_data'])
|
it "redirects to relative origin" do
|
||||||
expect(cookie_data["destination_url"]).to eq('/subpath')
|
post "/auth/google_oauth2?origin=/t/123"
|
||||||
end
|
get "/auth/google_oauth2/callback"
|
||||||
|
|
||||||
it "redirects to relative origin" do
|
expect(response.status).to eq 302
|
||||||
post "/auth/google_oauth2?origin=/t/123"
|
expect(response.location).to eq "http://test.localhost/t/123"
|
||||||
get "/auth/google_oauth2/callback"
|
|
||||||
|
|
||||||
expect(response.status).to eq 302
|
cookie_data = JSON.parse(response.cookies['authentication_data'])
|
||||||
expect(response.location).to eq "http://test.localhost/t/123"
|
expect(cookie_data["destination_url"]).to eq('/t/123')
|
||||||
|
end
|
||||||
|
|
||||||
cookie_data = JSON.parse(response.cookies['authentication_data'])
|
it "redirects with query" do
|
||||||
expect(cookie_data["destination_url"]).to eq('/t/123')
|
post "/auth/google_oauth2?origin=/t/123?foo=bar"
|
||||||
end
|
get "/auth/google_oauth2/callback"
|
||||||
|
|
||||||
it "redirects with query" do
|
expect(response.status).to eq 302
|
||||||
post "/auth/google_oauth2?origin=/t/123?foo=bar"
|
expect(response.location).to eq "http://test.localhost/t/123?foo=bar"
|
||||||
get "/auth/google_oauth2/callback"
|
|
||||||
|
|
||||||
expect(response.status).to eq 302
|
cookie_data = JSON.parse(response.cookies['authentication_data'])
|
||||||
expect(response.location).to eq "http://test.localhost/t/123?foo=bar"
|
expect(cookie_data["destination_url"]).to eq('/t/123?foo=bar')
|
||||||
|
end
|
||||||
|
|
||||||
cookie_data = JSON.parse(response.cookies['authentication_data'])
|
it "removes authentication_data cookie on logout" do
|
||||||
expect(cookie_data["destination_url"]).to eq('/t/123?foo=bar')
|
post "/auth/google_oauth2?origin=https://example.com/external"
|
||||||
end
|
get "/auth/google_oauth2/callback"
|
||||||
|
|
||||||
it "removes authentication_data cookie on logout" do
|
provider = log_in_user(Fabricate(:user))
|
||||||
post "/auth/google_oauth2?origin=https://example.com/external"
|
|
||||||
get "/auth/google_oauth2/callback"
|
|
||||||
|
|
||||||
provider = log_in_user(Fabricate(:user))
|
expect(cookies['authentication_data']).to be
|
||||||
|
|
||||||
expect(cookies['authentication_data']).to be
|
log_out_user(provider)
|
||||||
|
|
||||||
log_out_user(provider)
|
expect(cookies['authentication_data']).to be_nil
|
||||||
|
|
||||||
expect(cookies['authentication_data']).to be_nil
|
|
||||||
end
|
|
||||||
|
|
||||||
after do
|
|
||||||
cookies.delete('fsl')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user