diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rb
index b03675c2c..7280f71f2 100644
--- a/app/helpers/settings_helper.rb
+++ b/app/helpers/settings_helper.rb
@@ -1,4 +1,13 @@
module SettingsHelper
+ def oauth_logins
+ [
+ (:twitter if feature?(:twitter_login)),
+ (:facebook if feature?(:facebook_login)),
+ (:google_oauth2 if feature?(:google_login)),
+ (:wordpress_oauth2 if feature?(:wordpress_login))
+ ].compact
+ end
+
def feature?(name)
setting["feature.#{name}"].presence || setting["process.#{name}"].presence
end
diff --git a/app/views/devise/_omniauth_form.html.erb b/app/views/devise/_omniauth_form.html.erb
index d820e5e4e..516e32cbb 100644
--- a/app/views/devise/_omniauth_form.html.erb
+++ b/app/views/devise/_omniauth_form.html.erb
@@ -6,38 +6,11 @@
- <% if feature? :twitter_login %>
+ <% oauth_logins.each do |login| %>
- <%= link_to t("omniauth.twitter.name"), user_twitter_omniauth_authorize_path,
- title: t("omniauth.twitter.#{action}"),
- class: "button-twitter button expanded",
- method: :post %>
-
- <% end %>
-
- <% if feature? :facebook_login %>
-
- <%= link_to t("omniauth.facebook.name"), user_facebook_omniauth_authorize_path,
- title: t("omniauth.facebook.#{action}"),
- class: "button-facebook button expanded",
- method: :post %>
-
- <% end %>
-
- <% if feature? :google_login %>
-
- <%= link_to t("omniauth.google_oauth2.name"), user_google_oauth2_omniauth_authorize_path,
- title: t("omniauth.google_oauth2.#{action}"),
- class: "button-google button expanded",
- method: :post %>
-
- <% end %>
-
- <% if feature? :wordpress_login %>
-
- <%= link_to t("omniauth.wordpress_oauth2.name"), user_wordpress_oauth2_omniauth_authorize_path,
- title: t("omniauth.wordpress_oauth2.#{action}"),
- class: "button-wordpress button expanded",
+ <%= link_to t("omniauth.#{login}.name"), send("user_#{login}_omniauth_authorize_path"),
+ title: t("omniauth.#{login}.#{action}"),
+ class: "button-#{login.to_s.delete_suffix("_oauth2")} button expanded",
method: :post %>
<% end %>