summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAndrei Gliga <otzy_007@yahoo.com>2016-05-04 13:33:33 +0300
committerAndrei Gliga <otzy_007@yahoo.com>2016-05-12 13:44:46 +0300
commitcf300443147f1a9ba3acf83ce839afdffa5173bd (patch)
tree69a2c7a8ffbb0677848c26914dcb6b9cbc7a87c5 /app
parentd8085d8e128e4ef50443f7a58bfbe7bf21565ab0 (diff)
downloadgitlab-ce-cf300443147f1a9ba3acf83ce839afdffa5173bd.tar.gz
OAuth Providers disable from the ApplicationSettings page
Diffstat (limited to 'app')
-rw-r--r--app/helpers/application_settings_helper.rb15
-rw-r--r--app/views/admin/application_settings/_form.html.haml10
2 files changed, 25 insertions, 0 deletions
diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb
index 914b0ef6042..17d73899878 100644
--- a/app/helpers/application_settings_helper.rb
+++ b/app/helpers/application_settings_helper.rb
@@ -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
diff --git a/app/views/admin/application_settings/_form.html.haml b/app/views/admin/application_settings/_form.html.haml
index e0d8d16a954..057b237c066 100644
--- a/app/views/admin/application_settings/_form.html.haml
+++ b/app/views/admin/application_settings/_form.html.haml
@@ -110,6 +110,16 @@
= 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
.checkbox