templates/security/ealogin.html.twig line 1

Open in your IDE?
  1. {# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
  2. {# This template checks for 'ea' variable existence because it can
  3.    be used in a EasyAdmin Dashboard controller, where 'ea' is defined
  4.    or from any other Symfony controller, where 'ea' is not defined #}
  5. {% extends ea is defined ? ea.templatePath('layout') : '@EasyAdmin/page/login_minimal.html.twig' %}
  6. {% trans_default_domain ea is defined ? ea.i18n.translationDomain : (translation_domain is defined ? translation_domain ?? 'messages') %}
  7. {% block body_class 'page-login' %}
  8. {% block page_title %}{{ page_title is defined ? page_title|raw : (ea is defined ? ea.dashboardTitle|raw : '') }}{% endblock %}
  9. {% block wrapper_wrapper %}
  10.     {% set page_title = block('page_title') %}
  11.     {% set _username_label = username_label is defined ? username_label|trans : 'login_page.username'|trans({}, 'EasyAdminBundle') %}
  12.     {% set _password_label = password_label is defined ? password_label|trans : 'login_page.password'|trans({}, 'EasyAdminBundle') %}
  13.     {% set _sign_in_label = sign_in_label is defined ? sign_in_label|trans : 'login_page.sign_in'|trans({}, 'EasyAdminBundle') %}
  14.     <div class="login-wrapper">
  15.         <header class="main-header mb-4">
  16.             <div id="header-logo">
  17.                 {% block header_logo %}
  18.                     {% if page_title %}
  19.                         {% if ea is defined %}
  20.                             <a class="logo {{ page_title|length > 14 ? 'logo-long' }}" title="{{ page_title|striptags }}" href="{{ path(ea.dashboardRouteName) }}">
  21.                                 {{ page_title|raw }}
  22.                             </a>
  23.                         {% else %}
  24.                             <div class="logo {{ page_title|length > 14 ? 'logo-long' }}">
  25.                                 {{ page_title|raw }}
  26.                             </div>
  27.                         {% endif %}
  28.                     {% endif %}
  29.                 {% endblock header_logo %}
  30.             </div>
  31.         </header>
  32.         <section class="content">
  33.             {% if error|default(false) %}
  34.                 <div class="w-100 alert alert-danger rounded mb-3">
  35.                     <i class="fas fa-times-circle mr-1"></i>
  36.                     {{ error.messageKey|trans(error.messageData, 'security') }}
  37.                 </div>
  38.             {% endif %}
  39.             <form method="post" action="{{ action|default('') }}">
  40.                 <input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}">
  41.                 <input type="hidden" name="{{ target_path_parameter|default('_target_path') }}" value="{{ target_path|default(ea is defined ? path(ea.dashboardRouteName) : '/') }}" />
  42.                 <div class="mb-3">
  43.                     <label for="username">{{ _username_label }}</label>
  44.                     <input type="email" value="{{ last_username }}" name="email" id="inputEmail" class="form-control" autocomplete="email" required autofocus>
  45.                 </div>
  46.                 <div class="mb-4">
  47.                     <label for="password">{{ _password_label }}</label>
  48.                     <input type="password" name="password" id="inputPassword" class="form-control" autocomplete="current-password" required>
  49.                 </div>
  50.                 <button type="submit" class="btn btn-primary btn-lg btn-block" onclick="this.form.submit(); this.disabled=true;">{{ _sign_in_label }}</button>
  51.             </form>
  52.             <script type="text/javascript">
  53.                 const loginForm = document.querySelector('form');
  54.                 loginForm.addEventListener('submit', () => {
  55.                     loginForm.querySelector('button[type="submit"]').setAttribute('disabled', 'disabled');
  56.                 }, false);
  57.             </script>
  58.         </section>
  59.     </div>
  60. {% endblock %}