Fix wrong redirect after sign-in for RS OAuth
We use a custom auth method to pre-fill the username when reaching the RS OAuth while signed out. However, it needs to redirect back to the RS OAuth page after sign-in, and not to the root path.
This commit is contained in:
@@ -54,6 +54,11 @@ RSpec.describe 'remoteStorage OAuth Dialog', type: :feature do
|
||||
context "when signed out" do
|
||||
let(:user) { create :user }
|
||||
|
||||
before do
|
||||
allow_any_instance_of(User).to receive(:valid_ldap_authentication?)
|
||||
.with(user.password).and_return(true)
|
||||
end
|
||||
|
||||
it "prefills the username field in the signin form" do
|
||||
visit new_rs_oauth_path(useraddress: user.address,
|
||||
redirect_uri: "http://example.com",
|
||||
@@ -62,5 +67,19 @@ RSpec.describe 'remoteStorage OAuth Dialog', type: :feature do
|
||||
|
||||
expect(find("#user_cn").value).to eq(user.cn)
|
||||
end
|
||||
|
||||
it "redirects to the OAuth dialog after sign-in" do
|
||||
auth_url = new_rs_oauth_url(useraddress: user.address,
|
||||
redirect_uri: "http://example.com",
|
||||
client_id: "http://example.com",
|
||||
scope: "documents,[photos], contacts:r")
|
||||
visit auth_url
|
||||
|
||||
fill_in "User", with: user.cn
|
||||
fill_in "Password", with: user.password
|
||||
click_button "Log in"
|
||||
|
||||
expect(current_url).to eq(auth_url)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user