<%- title t('users.sign_in_title', site_name: site_name) %>
<%- description 'Sign in page for Greasy Fork accounts.' %>

<% if params[:return_to] == SessionsController::BANNED_DELETE_PATH %>
  <p><%= t('users.banned_delete.intro') %></p>
<% else %>
  <p><%= t('users.sign_in_description', site_name: site_name) %></p>
<% end %>

<div class="centered-sections">
  <h3><%= t('users.sign_in_external') %></h3>

  <div>
    <% if available_auths.empty? %>
      <p>(No external providers configured.)</p>
    <% else %>
      <%= form_tag '', class: 'inline-form external-login-form' do %>
        <div>
          <% available_auths.keys.reverse_each do |provider| %>
            <span class="external-login-container">
              <button formaction="/auth/<%= provider %>?locale_id=<%= request_locale.id %>" class="external-login <%= provider %>-login">
                <%= t('users.sign_in_with', provider: Identity.pretty_provider(provider)) %>
              </button>
            </span>
          <% end %>
        </div>

        <% if sleazy? %>
          <p>
            <%= it('users.sign_in_github_unavailable', sign_in_url: It.link("https://#{greasyfork_host}/auth/github/?locale_id=#{request_locale.id}")) %>
          </p>
        <% end %>

        <% if devise_mapping.rememberable? %>
          <div class="remember-me"><%= check_box_tag :remember_me %><%= label_tag :remember_me, t('activerecord.attributes.user.remember_me') %></div>
        <% end %>
      <% end %>
    <% end %>
  </div>

  <h3><%= t('users.sign_in_password') %></h3>

  <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
    <div class="field">
      <%= f.label :email %><br>
      <%= f.email_field :email, autofocus: true, autocomplete: 'email' %>
    </div>

    <div class="field">
      <%= f.label :password %><br>
      <%= f.password_field :password, autocomplete: 'off' %>
    </div>

    <% if devise_mapping.rememberable? -%>
      <div class="field">
        <%= f.check_box :remember_me %>
        <%= f.label :remember_me %>
      </div>
    <% end -%>

    <div class="actions">
      <%= f.submit t('.sign_in') %>
    </div>
  <% end %>

  <%= render 'devise/shared/links' %>
</div>
