OAuth Providers disable from the ApplicationSettings page

This commit is contained in:
Andrei Gliga 2016-05-04 13:33:33 +03:00
parent d8085d8e12
commit cf30044314
2 changed files with 25 additions and 0 deletions

View File

@ -60,4 +60,19 @@ module ApplicationSettingsHelper
end
end
end
def oauth_providers_checkboxes(help_block_id)
button_based_providers.map do |source|
checked = current_application_settings.disabled_oauth_sign_in_sources.include?(source.to_s)
css_class = 'btn'
css_class += ' active' if checked
checkbox_name = 'application_setting[disabled_oauth_sign_in_sources][]'
label_tag(checkbox_name, class: css_class) do
check_box_tag(checkbox_name, source, checked,
autocomplete: 'off',
'aria-describedby' => help_block_id) + Gitlab::OAuth::Provider.label_for(source)
end
end
end
end

View File

@ -109,6 +109,16 @@
= f.label :signin_enabled do
= f.check_box :signin_enabled
Sign-in enabled
.form-group
= f.label :disable_oauth_signin_sources, class: 'control-label col-sm-2'
.col-sm-10
- data_attrs = { toggle: 'buttons' }
.btn-group{ data: data_attrs }
- oauth_providers_checkboxes('oauth-providers-help').each do |source|
= source
%span.help-block#oauth-providers-help
Enabled OmniAuth must be configured for GitHub
= link_to "(?)", help_page_path("integration", "github")
.form-group
= f.label :two_factor_authentication, 'Two-factor authentication', class: 'control-label col-sm-2'
.col-sm-10