osunyorg/admin

View on GitHub
app/views/devise/sessions/new.html.erb

Summary

Maintainability
Test Coverage
<%= content_for :title, t('.title', title: current_extranet.present? ? current_extranet.to_s_in(current_language) : 'Osuny') %>

<h1 class="h4 d-none">
  <%= t('.title', title: current_extranet.present? ? current_extranet.to_s_in(current_language) : 'Osuny') %>
</h1>
<div class="row">
  <div class="col-lg-6 mb-5">
    <h2 class="h4 mb-3"><%= t('login.already_registered') %></h2>
    <p class="mb-4"><%= t('login.already_registered_details') %></p>
    <% if current_context.has_sso? %>
      <%
      if current_context.try(:localizable?)
        current_context_l10n = current_context.localization_for(current_language)
        button_label = current_context_l10n&.sso_button_label
      else
        button_label = current_context.sso_button_label
      end
      button_label = button_label.presence || t('login.sign_in_with_sso')
      %>
      <p>
        <%= link_to button_label,
                    omniauth_authorize_path(resource_name, current_context.sso_provider),
                    method: :post,
                    class: 'btn btn-primary' %>
      </p>
      <p>
        <%= t('login.or') %>
      </p>
      <p>
        <a href="#collapseLoginForm" class="btn btn-primary mb-3 mt-2" data-bs-toggle="collapse">
          <%= t('login.sign_in_with_credentials') %>
        </a>
      </p>
    <% end %>

    <div class="<%= 'collapse' if current_context.has_sso? %> <%= 'show' unless alert.blank? %>" id="collapseLoginForm">

      <%= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
        <div class="form-inputs">
          <%= f.input :email,
                      required: false,
                      autofocus: true,
                      input_html: { autocomplete: "email" } %>
          <div class="mb-3 password optional user_password password_with_hints">
            <%= f.input :password,
                        as: :password_with_hints,
                        allow_password_uncloaking: true,
                        required: false,
                        wrapper: false,
                        input_html: { autocomplete: "current-password" } %>
            <small>
              <%= link_to t("devise.passwords.new.forgot_your_password"), new_password_path(resource_name) %>
            </small>
          </div>
          <%= f.input :remember_me, as: :boolean if devise_mapping.rememberable? %>
        </div>

        <div class="form-actions">
          <%= f.button :submit, t(".sign_in"), class: 'btn btn-primary' %>

        </div>
      <% end %>
    </div>
    <div class="mt-3 small">
      <% if devise_mapping.confirmable? %>
        <%= link_to t('devise.shared.links.didn_t_receive_confirmation_instructions'), new_confirmation_path(resource_name) %><br />
      <% end %>

      <% if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) %>
        <%= link_to t('devise.shared.links.didn_t_receive_unlock_instructions'), new_unlock_path(resource_name) %><br />
      <% end %>
    </div>
  </div>
  <div class="col-lg-6">
    <h2 class="h4 mb-3"><%= t('login.not_registered_yet') %></h2>
    <p class="mb-4"><%= t('login.not_registered_yet_details') %></p>
    <p class="form-actions">
      <%= link_to t("devise.registrations.new.sign_up"),
                  new_registration_path(resource_name),
                  class: 'btn btn-primary' %>
    </p>
  </div>
</div>