]> git.openstreetmap.org Git - rails.git/blob - app/views/application/_auth_providers.html.erb
Merge remote-tracking branch 'upstream/pull/5150'
[rails.git] / app / views / application / _auth_providers.html.erb
1 <% prefered_auth_button_available = @preferred_auth_provider != "openid" && Auth.providers.value?(@preferred_auth_provider) %>
2
3 <div>
4   <%= tag.div :id => "login_auth_buttons",
5               :class => ["collapse show row row-cols-1", { "row-cols-sm-2" => prefered_auth_button_available }, "g-2 mb-3"] do %>
6
7     <% if prefered_auth_button_available %>
8       <div class="col justify-content-center d-flex align-items-center flex-wrap">
9         <%= auth_button_preferred @preferred_auth_provider %>
10       </div>
11     <% end %>
12
13     <div class="col justify-content-center d-flex align-items-center flex-wrap gap-2">
14       <% Auth.providers.each_value do |provider| %>
15         <% if provider == "openid" %>
16           <%= button_tag image_tag("auth_providers/openid.svg",
17                                    :alt => t(".openid.alt"),
18                                    :size => "36"),
19                          :type => "button",
20                          :data => { "bs-toggle" => "collapse",
21                                     "bs-target" => "#login_auth_buttons, #openid_login_form" },
22                          :title => t(".openid.title"),
23                          :class => "btn btn-light p-2" %>
24         <% elsif provider != @preferred_auth_provider %>
25           <%= auth_button provider %>
26         <% end -%>
27       <% end -%>
28     </div>
29   <% end %>
30
31   <%# :tabindex starts high to allow rendering at the bottom of the template %>
32   <%= form_tag auth_path(:provider => "openid"), :id => "openid_login_form", :class => "collapse" do %>
33     <div class="mb-3">
34       <label for="openid_url" class="form-label">
35         <%= image_tag "auth_providers/openid.svg", :size => "36", :alt => "", :class => "align-text-bottom" %>
36         <%= t ".openid_url" %>
37       </label>
38       <%= hidden_field_tag("referer", params[:referer], :autocomplete => "off") %>
39       <%= text_field_tag("openid_url", "https://", :tabindex => 20, :autocomplete => "on", :class => "form-control") %>
40       <span class="form-text text-body-secondary">(<a href="<%= t "accounts.edit.openid.link" %>" target="_new"><%= t "accounts.edit.openid.link text" %></a>)</span>
41     </div>
42
43     <%= submit_tag t(".openid_login_button"), :tabindex => 21, :class => "btn btn-primary" %>
44   <% end %>
45 </div>