{#
 # ---------------------------------------------------------------------
 #
 # GLPI - Gestionnaire Libre de Parc Informatique
 #
 # http://glpi-project.org
 #
 # @copyright 2015-2024 Teclib' and contributors.
 # @copyright 2003-2014 by the INDEPNET Development Team.
 # @licence   https://www.gnu.org/licenses/gpl-3.0.html
 #
 # ---------------------------------------------------------------------
 #
 # LICENSE
 #
 # This file is part of GLPI.
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 #
 # ---------------------------------------------------------------------
 #}

{% extends 'layout/page_card_notlogged.html.twig' %}

{% block content_block %}
   {% if token_ok is defined and token_ok == false %}
      {{ __('Your password reset request has expired or is invalid. Please renew it.') }}
   {% elseif messages_only is defined %}
      {{ include('components/messages_after_redirect_alerts.html.twig') }}
   {% else %}
      <form action="{{ path('front/lostpassword.php') }}" method="post" autocomplete="off" data-submit-once>
         <input type="hidden" name="_glpi_csrf_token" value="{{ csrf_token() }}" />
         <h2 class="card-title text-center mb-4">{{ __('Forgotten password?') }}</h2>

         {% if token is defined %}
            <input type="hidden" name="password_forget_token" value="{{ token }}" />
            <p class="text-muted mb-4">
               {{ __('Please enter your new password.') }}
            </p>
            <div class="mb-3">
               <label class="form-label">{{ __('Password') }}</label>
               <input type="password" name="password" autocomplete="new-password"
                      class="form-control" placeholder="{{ __('Password') }}"
                      id="password" onkeyup="return passwordCheck();" />
            </div>
            <div class="mb-3">
               <label class="form-label">{{ __('Password confirmation') }}</label>
               <input type="password" name="password2" autocomplete="new-password2"
                        class="form-control" placeholder="{{ __('Password') }}" />
            </div>

            {% if config('use_password_security') %}
               <div class="alert alert-warning">
                  <h3>{{ __('Password security policy') }}</h3>
                  {% do call('Config::displayPasswordSecurityChecks') %}
               </div>
            {% endif %}

            {% set save_button = '<i class="far fa-save"></i><span>' ~ __('Save new password') ~ '<span>' %}

         {% else %}
            <p class="text-muted mb-4">
               {{ __('Please enter your email address. An email will be sent to you and you will be able to choose a new password.') }}
            </p>
            <div class="mb-3">
               <label class="form-label">{{ _n('Email', 'Emails', 1) }}</label>
               <input type="email" name="email" class="form-control" placeholder="{{ _n('Email', 'Emails', 1) }}" />
            </div>
            {% set save_button = '<i class="fas fa-envelope"></i><span>' ~ __('Send') ~ '<span>' %}
         {% endif %}

         <div class="form-footer">
            <button class="btn btn-icon btn-primary w-100" name="update">
               {{ save_button|raw }}
            </button>
         </div>
      </form>
   {% endif %}
{% endblock %}

{% block footer_block %}
   {{ __('Forget it,') }}
   <a href="{{ index_path() }}">{{ __('send me back') }}</a>
   {{ __('to the login screen.') }}
{% endblock %}
