{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
{# This template checks for 'ea' variable existence because it can
be used in a EasyAdmin Dashboard controller, where 'ea' is defined
or from any other Symfony controller, where 'ea' is not defined #}
{% extends ea is defined ? ea.templatePath('layout') : '@EasyAdmin/page/login_minimal.html.twig' %}
{% trans_default_domain ea is defined ? ea.i18n.translationDomain : (translation_domain is defined ? translation_domain ?? 'messages') %}
{% block body_class 'page-login' %}
{% block page_title %}{{ page_title is defined ? page_title|raw : (ea is defined ? ea.dashboardTitle|raw : '') }}{% endblock %}
{% block wrapper_wrapper %}
{% set page_title = block('page_title') %}
{% set _username_label = username_label is defined ? username_label|trans : 'login_page.username'|trans({}, 'EasyAdminBundle') %}
{% set _password_label = password_label is defined ? password_label|trans : 'login_page.password'|trans({}, 'EasyAdminBundle') %}
{% set _sign_in_label = sign_in_label is defined ? sign_in_label|trans : 'login_page.sign_in'|trans({}, 'EasyAdminBundle') %}
<div class="login-wrapper">
<header class="main-header mb-4">
<div id="header-logo">
{% block header_logo %}
{% if page_title %}
{% if ea is defined %}
<a class="logo {{ page_title|length > 14 ? 'logo-long' }}" title="{{ page_title|striptags }}" href="{{ path(ea.dashboardRouteName) }}">
{{ page_title|raw }}
</a>
{% else %}
<div class="logo {{ page_title|length > 14 ? 'logo-long' }}">
{{ page_title|raw }}
</div>
{% endif %}
{% endif %}
{% endblock header_logo %}
</div>
</header>
<section class="content">
{% if error|default(false) %}
<div class="w-100 alert alert-danger rounded mb-3">
<i class="fas fa-times-circle mr-1"></i>
{{ error.messageKey|trans(error.messageData, 'security') }}
</div>
{% endif %}
<form method="post" action="{{ action|default('') }}">
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}">
<input type="hidden" name="{{ target_path_parameter|default('_target_path') }}" value="{{ target_path|default(ea is defined ? path(ea.dashboardRouteName) : '/') }}" />
<div class="mb-3">
<label for="username">{{ _username_label }}</label>
<input type="email" value="{{ last_username }}" name="email" id="inputEmail" class="form-control" autocomplete="email" required autofocus>
</div>
<div class="mb-4">
<label for="password">{{ _password_label }}</label>
<input type="password" name="password" id="inputPassword" class="form-control" autocomplete="current-password" required>
</div>
<button type="submit" class="btn btn-primary btn-lg btn-block" onclick="this.form.submit(); this.disabled=true;">{{ _sign_in_label }}</button>
</form>
<script type="text/javascript">
const loginForm = document.querySelector('form');
loginForm.addEventListener('submit', () => {
loginForm.querySelector('button[type="submit"]').setAttribute('disabled', 'disabled');
}, false);
</script>
</section>
</div>
{% endblock %}