Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

3.6 KB
Raw Blame
<%#-- copyright
OpenProject is an open source project management software.
Copyright (C) the OpenProject GmbH

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 3.

OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
Copyright (C) 2006-2013 Jean-Philippe Lang
Copyright (C) 2010-2013 the ChiliProject Team

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

See COPYRIGHT and LICENSE files for more details.

++#%>

<%= styled_form_tag(
      { action: "login" },
      autocomplete: "off",
      class: "-wide-labels user-login--form",
      data: { turbo: false } # allow redirects without turbo
    ) do %>
  <%= back_url_hidden_field_tag %>

  <div class="form--field -required">
    <%= styled_label_tag "username", User.human_attribute_name(:login) %>
    <div class="form--field-container">
      <%= styled_text_field_tag "username", params[:username], autofocus: params[:username].blank?, autocapitalize: "none" %>
    </div>
  </div>

  <div class="form--field -required">
    <%= styled_label_tag "password", User.human_attribute_name(:password) %>
    <div class="form--field-container">
      <%= styled_password_field_tag "password", nil, autofocus: params[:username].present? %>
    </div>
  </div>

  <% if Setting::Autologin.enabled? %>
    <div class="form--field -no-label">
      <div class="form--field-container">
        <label class="form--label-with-check-box">
          <%= styled_check_box_tag "autologin", 1, false %>
          <%= t("users.autologins.prompt", num_days: I18n.t("datetime.distance_in_words.x_days", count: Setting.autologin)) %>
        </label>
      </div>
    </div>
  <% end %>

  <div class="login-form--footer">
    <%= submit_tag t(:button_login),
                   name: :login,
                   class: "button -primary button_no-margin",
                   data: {
                     controller: "disable-when-clicked",
                     "disable-when-clicked-text-value": t(:label_loading)
                   } %>

    <div class="login-options-container">
      <div class="login-links">
        <% if Setting.lost_password? %>
          <%= link_to t(:label_password_lost),
                      { controller: "/account", action: "lost_password" },
                      class: "login-form--footer-link" %>
          <br>
        <% end %>
        <% if Setting::SelfRegistration.enabled? %>
          <%= link_to t(:label_register),
                      "",
                      title: t(:label_register),
                      class: "login-form--footer-link registration-modal--activation-link" %>
        <% end %>
      </div>
    </div>
  </div>
<% end %>

<section data-augmented-model-wrapper
         data-activation-selector=".registration-modal--activation-link"
         data-modal-class-name="registration-modal -primary">
  <% @user ||= User.new %>
  <%= render partial: "/account/register" %>
</section>