{% extends 'layout_web.html.twig' %}
{% block title %}{{ 'login.title'|trans }} | {{parent()}}{% endblock %}
{% block body %}
<div class="page">
<div class="page-single">
<div class="container">
<div class="row">
<div class="col col-md-5 mx-auto">
<div class="text-center mb-6">
<img src="{{ asset('/images/logo-pbn-200x100.png')}}" alt="{{appname}}">
</div>
{% if app.user %}
<div class="text-center">
<h4>{{ 'login.alreadylogin'|trans }} {{ app.user.username }}</h4>
<p><a href="{{ path('app_logout') }}">{{ 'login.logout'|trans }}</a></p>
</div>
{% else %}
{% if error %}
<div class="alert alert-danger">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
{% endif %}
{% for flash in app.flashes('success') %}
<div class="alert alert-success" role="alert">{{ flash }}</div>
{% endfor %}
{% for flash in app.flashes('error') %}
<div class="alert alert-danger" role="alert">{{ flash }}</div>
{% endfor %}
<form class="card" action="" method="post">
<div class="card-body p-6">
<div class="float-right">
<a href="{{ path(app.request.get('_route'), app.request.get('_route_params')|merge({'_locale': ''})) }}"><span class="flag flag-fr mr-3"></span></a>
<a href="{{ path(app.request.get('_route'), app.request.get('_route_params')|merge({'_locale': 'en'})) }}"><span class="flag flag-gb"></span></a>
</div>
<div class="card-title">{{ 'login.title'|trans }}</div>
<div class="form-group">
<label for="inputEmail" class="form-label">{{ 'login.email'|trans }}</label>
<input type="email" value="{{ last_username }}" name="email" id="inputEmail" class="form-control" autocomplete="email" required autofocus>
</div>
<div class="form-group">
<label for="inputPassword" class="form-label">
{{ 'login.password'|trans }}
<a href="{{ path('app_forgot_password_request') }}" class="float-right small">{{ 'login.resetpassword'|trans }}</a>
</label>
<input type="password" name="password" id="inputPassword" class="form-control" autocomplete="current-password" required>
<i class="fe fe-eye-off" id="togglePassword"></i>
</div>
<div class="form-group">
<label class="custom-control custom-checkbox">
<input type="checkbox" name="_remember_me" class="custom-control-input"> <span class="custom-control-label">{{ 'login.remember'|trans }}</span>
</label>
</div>
<div class="form-footer">
<button type="submit" class="btn btn-primary btn-block"> {{ 'login.signin'|trans }}</button>
</div>
</div>
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}" >
</form>
<div class="text-center text-muted">
<a href="{{ path('app_register') }}">{{ 'login.newaccount'|trans }}</a>
</div>
</div>
</div>
</div>
</div>
</div>
{% endif %}
<style>
#togglePassword {
position: absolute;
right: 1.5em;
cursor: pointer;
margin-right: 25px;
margin-top: -27px;
}
</style>
<script>
const togglePassword = document.querySelector("#togglePassword");
const password = document.querySelector("#inputPassword");
togglePassword.addEventListener("click", function () {
// toggle the type attribute
const type = password.getAttribute("type") === "password" ? "text" : "password";
password.setAttribute("type", type);
// toggle the icon
if (type == "text") {
this.classList.remove("fe-eye-off");
this.classList.add("fe-eye");
}
if (type == "password") {
this.classList.remove("fe-eye");
this.classList.add("fe-eye-off");
}
});
</script>
{% endblock %}