<%# locals: (return_to: nil, message: nil) %>

<% message ||= t('users.add_external_sign_in_info') %>

<% available_providers = (available_auths.keys - current_user.identity_providers_used) %>
<% if !available_providers.empty? %>
  <%= message %>
  <% available_providers.each do |provider| %>
    <span class="external-login-container">
      <%= form_with(url: "/auth/#{provider}", method: :post) do %>
        <button class="external-login <%= provider %>-login">
          <%= t('users.sign_in_with', provider: Identity.pretty_provider(provider)) %>
        </button>
        <% if return_to %>
          <%= hidden_field_tag(:return_to, return_to) %>
        <% end %>
      <% end %>
    </span>
  <% end %>
<% end %>
