Use proper labels for OAuth providers

This commit is contained in:
Douwe Maan 2015-11-03 17:58:26 +01:00
parent 4773d98e83
commit 98dcad2762
1 changed files with 8 additions and 1 deletions

View File

@ -1,6 +1,12 @@
module Gitlab
module OAuth
class Provider
LABELS = {
"github" => "GitHub",
"gitlab" => "GitLab.com",
"google_oauth2" => "Google"
}.freeze
def self.providers
Devise.omniauth_providers
end
@ -23,8 +29,9 @@ module Gitlab
end
def self.label_for(name)
name = name.to_s
config = config_for(name)
(config && config['label']) || name.to_s.titleize
(config && config['label']) || LABELS[name] || name.titleize
end
end
end