]> git.openstreetmap.org Git - rails.git/blobdiff - lib/auth.rb
Merge remote-tracking branch 'upstream/pull/5231'
[rails.git] / lib / auth.rb
index 6361739288aee738b1e874234969b518197edb91..729772477757ac810113e6abf77a92fead58e904 100644 (file)
@@ -1,6 +1,15 @@
 module Auth
-  PROVIDERS = { "None" => "", "OpenID" => "openid" }
-  PROVIDERS["Google"] = "google" if defined?(GOOGLE_AUTH_ID)
-  PROVIDERS["Facebook"] = "facebook" if defined?(FACEBOOK_AUTH_ID)
-  PROVIDERS["Windows Live"] = "windowslive" if defined?(WINDOWSLIVE_AUTH_ID)
+  @providers = {}
+
+  def self.providers
+    @providers[I18n.locale] ||= {
+      I18n.t("auth.providers.openid") => "openid"
+    }.tap do |providers|
+      providers[I18n.t("auth.providers.google")] = "google" if Settings.key?(:google_auth_id)
+      providers[I18n.t("auth.providers.facebook")] = "facebook" if Settings.key?(:facebook_auth_id)
+      providers[I18n.t("auth.providers.microsoft")] = "microsoft" if Settings.key?(:microsoft_auth_id)
+      providers[I18n.t("auth.providers.github")] = "github" if Settings.key?(:github_auth_id)
+      providers[I18n.t("auth.providers.wikipedia")] = "wikipedia" if Settings.key?(:wikipedia_auth_id)
+    end.freeze
+  end
 end