<link rel="prefetch" href="<%= path_to_javascript 'application' %>" as="script" />

<div class="box wide">
  <% if Rails.application.read_only? %>
    <p>
    The site is currently in read-only mode for maintenance.
    </p>
  <% else %>
    <%= form_with url: login_path do |form| %>
    <p>
      <%= form.label :email, "E-mail or Username:" %>
      <%= form.text_field :email, :size => 40, :inputmode => "email", :autofocus => "autofocus" %>
      <br />

      <%= form.label :password, "Password:" %>
      <%= form.password_field :password, :size => 30 %>
      <br />
      </p>

      <p>
      <%= form.submit "Login" %>
      </p>

      <p>
      Forgot your password or deleted your account?
        <%= link_to "Reset your password", forgot_password_path %>.
      </p>

      <% if Rails.application.open_signups? %>
        <p>
          Not a user yet? <a href="/invitations/open">Sign up here</a>.
        </p>
      <% elsif Rails.application.allow_invitation_requests? %>
        Not a user yet? <a href="/invitations/request">Request an invite</a>.
      <% else %>
        <p>
        Not a user yet?
        Read about <a href="/about#invitations">how invitations work</a> and see if you know
        <%= link_to 'a current user', users_tree_path %> of the site.
        The <a href="/chat">chat room</a> does not require an invitation.
        </p>
      <% end %>

      <% if @referer.present? %>
        <%= form.hidden_field :referer, value: @referer %>
      <% end %>
    <% end %>
  <% end %>
</div>
