Commit 9fcdcb8b authored by Valery Sizov's avatar Valery Sizov

Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into ce_upstream

parents 64bb46e1 bb3563b5
......@@ -10,6 +10,10 @@ module AuthHelper
auth_providers.include?(:kerberos)
end
def omniauth_enabled?
Gitlab.config.omniauth.enabled
end
def provider_has_icon?(name)
PROVIDERS_WITH_ICONS.include?(name.to_s)
end
......
......@@ -4,7 +4,7 @@
= render 'devise/shared/signin_box'
-# Omniauth fits between signin/ldap signin and signup and does not have a surrounding box
- if Gitlab.config.omniauth.enabled && devise_mapping.omniauthable? && button_based_providers.any?
- if omniauth_enabled? && devise_mapping.omniauthable? && button_based_providers.any?
.clearfix.prepend-top-20
= render 'devise/shared/omniauth_box'
......@@ -14,6 +14,6 @@
= render 'devise/shared/signup_box'
-# Show a message if none of the mechanisms above are enabled
- if !signin_enabled? && !ldap_enabled? && !(Gitlab.config.omniauth.enabled && devise_mapping.omniauthable?)
- if !signin_enabled? && !ldap_enabled? && !(omniauth_enabled? && devise_mapping.omniauthable?)
%div
No authentication methods configured.
......@@ -18,7 +18,7 @@ You accept and agree to the following terms and conditions for Your present and
6. You are not expected to provide support for Your Contributions, except to the extent You desire to provide support. You may provide support for free, for a fee, or not at all. Unless required by applicable law or agreed to in writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON- INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
7. Should You wish to submit work that is not Your original creation, You may submit it to GitLab B.V. separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as "Submitted on behalf of a third-party: [[]named here]".
7. Should You wish to submit work that is not Your original creation, You may submit it to GitLab B.V. separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as "Submitted on behalf of a third-party: [insert_name_here]".
8. You agree to notify GitLab B.V. of any facts or circumstances of which you become aware that would make these representations inaccurate in any respect.
......
......@@ -69,6 +69,7 @@ branches and tags.
```bash
git remote add origin git@gitlab.com:<group>/<project>.git
git push --all origin
git push --tags origin
```
## Contribute to this guide
......
Feature: Login form
Scenario: I see Crowd form
Given Crowd integration enabled
When I visit sign in page
Then I should see Crowd login form
Scenario: I see Crowd form when sign-in is disabled
Given Crowd integration enabled
And Sign-in is disabled
When I visit sign in page
Then I should see Crowd login form
class Spinach::Features::LoginForm < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
include SharedSnippet
include SharedUser
include SharedSearch
step 'Sign-in is disabled' do
allow_any_instance_of(ApplicationHelper).to receive(:signin_enabled?).and_return(false)
end
step 'Crowd integration enabled' do
expect(Gitlab::OAuth::Provider).to receive(:providers).and_return([:crowd])
expect(Gitlab.config.omniauth).to receive(:enabled).and_return(true)
allow_any_instance_of(ApplicationHelper).to receive(:user_omniauth_authorize_path).and_return(root_path)
end
step 'I should see Crowd login form' do
expect(page).to have_selector '#tab-crowd form'
end
step 'I visit sign in page' do
visit new_user_session_path
end
end
require 'rails_helper'
describe 'devise/shared/_signin_box' do
describe 'Crowd form' do
before do
stub_devise
assign(:ldap_servers, [])
end
it 'is shown when Crowd is enabled' do
enable_crowd
render
expect(rendered).to have_selector('#tab-crowd form')
end
it 'is not shown when Crowd is disabled' do
render
expect(rendered).not_to have_selector('#tab-crowd')
end
end
def stub_devise
allow(view).to receive(:devise_mapping).and_return(Devise.mappings[:user])
allow(view).to receive(:resource).and_return(spy)
allow(view).to receive(:resource_name).and_return(:user)
end
def enable_crowd
allow(view).to receive(:form_based_providers).and_return([:crowd])
allow(view).to receive(:crowd_enabled?).and_return(true)
allow(view).to receive(:user_omniauth_authorize_path).with('crowd').
and_return('/crowd')
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