opf/openproject

View on GitHub
app/views/account/_register.html.erb

Summary

Maintainability
Test Coverage
<%#-- copyright
OpenProject is an open source project management software.
Copyright (C) 2012-2024 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.

++#%>

<div class="modal-delivery-element">
  <%= labelled_tabular_form_for(@user, url: account_register_path, html: { class: 'form -wide-labels spot-modal' }) do |f| %>

    <%= back_url_hidden_field_tag use_referer: false %>
    <%= error_messages_for :user %>

    <div id="spotModalTitle" class="spot-modal--header">
      <%= I18n.t('onboarding.welcome', app_title: Setting.app_title) %>
    </div>
    <div class="spot-divider"></div>
    <div class="spot-modal--body spot-container">
      <h2><%= t(:label_register) %></h2>
      <section class="form--section">
        <% if @user.ldap_auth_source_id.nil? %>
          <div class="form--field -required -wide-label">
            <% if Setting.email_login? %>
              <%= email_field(f) %>
            <% else %>
              <%= login_field(f) %>
            <% end %>
          </div>
        <% end %>
        <div class="form--field -required -wide-label">
          <%= f.text_field :firstname, required: true %>
        </div>

        <div class="form--field -required -wide-label">
          <%= f.text_field :lastname, required: true %>
        </div>

        <% if registration_show_email? %>
          <div class="form--field -required -wide-label">
            <%= email_field(f) %>
          </div>
        <% end %>

        <%= call_hook :view_account_register_after_basic_information, f: f %>

        <%= render partial: "customizable/form",
                   locals: { form: f, all_fields: false, only_required: true, wide_labels: true } %>

        <br/><br/>
        <% if @user.change_password_allowed? %>
          <div class="form--field -required -wide-label -reduced-margin">
            <%= f.password_field :password,
                                 required: true,
                                 size: 25,
                                 autocomplete: 'off' %>
            <div class="form--field-instructions">
              <%= password_complexity_requirements %>
            </div>
          </div>
          <div class="form--field -required -wide-label">
            <%= f.password_field :password_confirmation,
                                 required: true,
                                 size: 25,
                                 autocomplete: 'off' %>
          </div>
        <% end %>
      </section>

      <% if user_consent_required? %>
        <hr/>
        <%= render partial: 'account/user_consent_check' %>
      <% end %>

      <%= render partial: 'account/auth_providers', locals: { omniauth_title: I18n.t('account.signup_with_auth_provider'), wide: true } %>
    </div>

    <%= render partial: 'account/footer' %>
  <% end %>
</div>