{% extends 'base_logged_off.html.twig' %}
{% block title %}Log in!{% endblock %}
{% block body %}
<a href="{{ path('app_login') }}" class="pb-login-btn-socials float-right m-3">Sign in</a>
<a href="{{ path('app_register') }}" class="pb-login-btn-socials float-right m-3">Sign up</a>
<form method="post" id="pb-login-form" class=" hplogin col-6 offset-3 text-center">
{% if app.user %}
<div class="mb-3">
{{ 'You are logged in as %username%, will be redirect in few seconds..'|trans({'%username%': app.user.username, 'url_logout': path('app_logout') }) }}
<script type="text/javascript">
window.location.href = "{{ path('index_loginsuccess') }}";
</script>
</div>
{% else %}
<h1 class="login-head-title mb-5">{{ 'Restore your account password'|trans }}</h1>
{% if error %}
<div class="alert alert-danger">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
{% endif %}
{{ form_start(forgottenForm, { 'attr': { 'class': 'col-12' } }) }}
{{ form_errors(forgottenForm) }}
{% if errors|length > 0 %}
{% for error in errors %}
<div class="alert alert-danger">{{ error.message|trans([], 'security') }}</div>
{% endfor %}
{% endif %}
<fieldset id="register-form-fieldset" class="position-relative">
{{ form_widget(forgottenForm.email) }}
{{ form_label(forgottenForm.email) }}
</fieldset>
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}" />
<div class="row">
<div class="col-12 text-center mt-5">
<button type="submit" class="pg-button">{{ 'Restore password'|trans }}</button>
</div>
</div>
{{ form_end(forgottenForm) }}
{% endif %}
</form>
{% endblock %}