diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-06 00:08:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-06 00:08:13 +0300 |
commit | d3c29eae5c389e36d4751539fad0462053fb2b20 (patch) | |
tree | cc3ae497193f9334d0bc6ee4224637102f6e0d4e /app/helpers | |
parent | ad4dbe36445360521fc73a57df13bc8f12eeaa92 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/auth_helper.rb | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/app/helpers/auth_helper.rb b/app/helpers/auth_helper.rb index e8d3d5f62cb..1f15ac42260 100644 --- a/app/helpers/auth_helper.rb +++ b/app/helpers/auth_helper.rb @@ -16,10 +16,18 @@ module AuthHelper Gitlab::Auth.omniauth_enabled? end - def provider_has_icon?(name) + def provider_has_custom_icon?(name) + icon_for_provider(name.to_s) + end + + def provider_has_builtin_icon?(name) PROVIDERS_WITH_ICONS.include?(name.to_s) end + def provider_has_icon?(name) + provider_has_builtin_icon?(name) || provider_has_custom_icon?(name) + end + def qa_class_for_provider(provider) { saml: 'qa-saml-login-button', @@ -35,6 +43,10 @@ module AuthHelper Gitlab::Auth::OAuth::Provider.label_for(name) end + def icon_for_provider(name) + Gitlab::Auth::OAuth::Provider.icon_for(name) + end + def form_based_provider_priority ['crowd', /^ldap/, 'kerberos'] end @@ -109,7 +121,9 @@ module AuthHelper def provider_image_tag(provider, size = 64) label = label_for_provider(provider) - if provider_has_icon?(provider) + if provider_has_custom_icon?(provider) + image_tag(icon_for_provider(provider), alt: label, title: "Sign in with #{label}") + elsif provider_has_builtin_icon?(provider) file_name = "#{provider.to_s.split('_').first}_#{size}.png" image_tag("auth_buttons/#{file_name}", alt: label, title: "Sign in with #{label}") |