Compare commits
3 Commits
v0.8.1
...
d8a35ac3fd
| Author | SHA1 | Date | |
|---|---|---|---|
| d8a35ac3fd | |||
|
|
a91ee2bd0a
|
||
|
|
fcb6923c92
|
@@ -37,4 +37,8 @@ class ApplicationController < ActionController::Base
|
|||||||
format.any { head status }
|
format.any { head status }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def after_sign_in_path_for(user)
|
||||||
|
session[:user_return_to] || root_path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ class Rs::OauthController < ApplicationController
|
|||||||
def require_signed_in_with_username
|
def require_signed_in_with_username
|
||||||
unless user_signed_in?
|
unless user_signed_in?
|
||||||
username, org = params[:useraddress].split("@")
|
username, org = params[:useraddress].split("@")
|
||||||
|
session[:user_return_to] = request.url
|
||||||
redirect_to new_user_session_path(cn: username, ou: org)
|
redirect_to new_user_session_path(cn: username, ou: org)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ Sidekiq::Testing.inline! do
|
|||||||
35.times do |n|
|
35.times do |n|
|
||||||
username = Faker::Name.unique.first_name.downcase
|
username = Faker::Name.unique.first_name.downcase
|
||||||
email = Faker::Internet.unique.email
|
email = Faker::Internet.unique.email
|
||||||
|
next if username.length < 3
|
||||||
|
|
||||||
CreateAccount.call(
|
CreateAccount.call(
|
||||||
username: username, domain: "kosmos.org", email: email,
|
username: username, domain: "kosmos.org", email: email,
|
||||||
|
|||||||
@@ -54,6 +54,11 @@ RSpec.describe 'remoteStorage OAuth Dialog', type: :feature do
|
|||||||
context "when signed out" do
|
context "when signed out" do
|
||||||
let(:user) { create :user }
|
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
|
it "prefills the username field in the signin form" do
|
||||||
visit new_rs_oauth_path(useraddress: user.address,
|
visit new_rs_oauth_path(useraddress: user.address,
|
||||||
redirect_uri: "http://example.com",
|
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)
|
expect(find("#user_cn").value).to eq(user.cn)
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user