]> git.openstreetmap.org Git - rails.git/blob - lib/auth.rb
Cache OpenID provider names on a per-locale basis
[rails.git] / lib / auth.rb
1 module Auth
2   @providers = {}
3
4   def self.providers
5     @providers[I18n.locale] ||= {
6       I18n.t("auth.providers.none") => "",
7       I18n.t("auth.providers.openid") => "openid"
8     }.tap do |providers|
9       providers[I18n.t("auth.providers.google")] = "google" if Settings.key?(:google_auth_id)
10       providers[I18n.t("auth.providers.facebook")] = "facebook" if Settings.key?(:facebook_auth_id)
11       providers[I18n.t("auth.providers.windowslive")] = "windowslive" if Settings.key?(:windowslive_auth_id)
12       providers[I18n.t("auth.providers.github")] = "github" if Settings.key?(:github_auth_id)
13       providers[I18n.t("auth.providers.wikipedia")] = "wikipedia" if Settings.key?(:wikipedia_auth_id)
14     end.freeze
15   end
16 end