vendor/easycorp/easyadmin-bundle/src/Resources/views/page/login.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 _forgot_password_label = forgot_password_label is defined ? forgot_password_label|trans : 'login_page.forgot_password'|trans({}, 'EasyAdminBundle') %}
  14.     {% set _remember_me_label = remember_me_label is defined ? remember_me_label|trans : 'login_page.remember_me'|trans({}, 'EasyAdminBundle') %}
  15.     {% set _sign_in_label = sign_in_label is defined ? sign_in_label|trans : 'login_page.sign_in'|trans({}, 'EasyAdminBundle') %}
  16.     {% include '@EasyAdmin/flash_messages.html.twig' %}
  17.     <div class="login-wrapper">
  18.         <header class="main-header">
  19.             <div id="header-logo">
  20.                 {% block header_logo %}
  21.                     {% if page_title %}
  22.                         {% if ea is defined %}
  23.                             <a class="logo {{ page_title|length > 14 ? 'logo-long' }}" title="{{ page_title|striptags }}" href="{{ path(ea.dashboardRouteName) }}">
  24.                                 {{ page_title|raw }}
  25.                             </a>
  26.                         {% else %}
  27.                             <div class="logo {{ page_title|length > 14 ? 'logo-long' }}">
  28.                                 {{ page_title|raw }}
  29.                             </div>
  30.                         {% endif %}
  31.                     {% endif %}
  32.                 {% endblock header_logo %}
  33.             </div>
  34.         </header>
  35.         <section class="content">
  36.             {% if error|default(false) %}
  37.                 <div class="w-100 alert alert-danger rounded mb-3">
  38.                     <i class="fas fa-times-circle mr-1"></i>
  39.                     {{ error.messageKey|trans(error.messageData, 'security') }}
  40.                 </div>
  41.             {% endif %}
  42.             <form method="post" action="{{ action|default('') }}">
  43.                 {% if csrf_token_intention|default(false) %}
  44.                     <input type="hidden" name="_csrf_token" value="{{ csrf_token(csrf_token_intention) }}">
  45.                 {% endif %}
  46.                 <input type="hidden" name="{{ target_path_parameter|default('_target_path') }}" value="{{ target_path|default(ea is defined ? path(ea.dashboardRouteName) : '/') }}" />
  47.                 <div class="form-group">
  48.                     <label class="form-control-label required" for="username">{{ _username_label }}</label>
  49.                     <div class="form-widget">
  50.                         <input type="text" id="username" name="{{ username_parameter|default('_username') }}" class="form-control" value="{{ last_username|default('') }}" required autofocus autocomplete="username">
  51.                     </div>
  52.                 </div>
  53.                 <div class="form-group">
  54.                     <label class="form-control-label required" for="password">{{ _password_label }}</label>
  55.                     <div class="form-widget">
  56.                         <input type="password" id="password" name="{{ password_parameter|default('_password') }}" class="form-control" required autocomplete="current-password">
  57.                     </div>
  58.                     {% if forgot_password_enabled|default(false) %}
  59.                         <div class="form-text">
  60.                             <a href="{{ forgot_password_path|default('#') }}">{{ _forgot_password_label }}</a>
  61.                         </div>
  62.                     {% endif %}
  63.                 </div>
  64.                 {% if remember_me_enabled|default(false) %}
  65.                     <div class="form-group">
  66.                         <input class="form-check-input" type="checkbox" id="remember_me" name="{{ remember_me_parameter|default('_remember_me') }}" {{ remember_me_checked|default(false) ? 'checked' }}>
  67.                         <label class="form-check-label" for="remember_me">
  68.                             {{ _remember_me_label }}
  69.                         </label>
  70.                     </div>
  71.                 {% endif %}
  72.                 <div class="form-group">
  73.                     <button type="submit" class="btn btn-primary btn-lg btn-block" onclick="this.form.submit(); this.disabled=true;">{{ _sign_in_label }}</button>
  74.                 </div>
  75.             </form>
  76.             <script type="text/javascript">
  77.                 const loginForm = document.querySelector('form');
  78.                 loginForm.addEventListener('submit', function () {
  79.                     loginForm.querySelector('button[type="submit"]').setAttribute('disabled', 'disabled');
  80.                 }, false);
  81.             </script>
  82.         </section>
  83.     </div>
  84. {% endblock %}