{% extends totem_group_auth.extends|default('totem_submodules::totem.template.auth/index.twig') %}

{% set template = template|default({
    title: totem_group_auth.pages.forgot_password.title|default("Forgot password"),
    description: totem_group_auth.pages.forgot_password.description|default(false),
    logo: totem_group_auth.pages.forgot_password.logo
}) %}

{% block content %}
    {% set fields = totem_group_auth.pages.forgot_password.form_fields|default({
        "username": {
            "type": "input",
            "input_attributes": {
                "name": "username",
                "placeholder": "Username"
            }
        },
        "email": {
            "type": "input",
            "input_attributes": {
                "name": "email",
                "placeholder": "Emailaddress"
            }

        },
        "submit": {
            "type": "submit",
            "title": "Request a new password",
            "input_attributes": {
                "type": "submit",
                "class": "button--wide"
            }
        }
    }) %}

    {% for field in fields %}
        {% include "totem_submodules::totem.module.form/partials/fields/" ~ field.type|default('input') ~ ".twig" with field %}
    {% endfor %}

{% endblock %}

{% block footer %}
    {% set routes = totem_group_auth.pages.forgot_password.routes|default({
        "forgot_password": {
            "title": "Cancel &amp; go back",
            "attributes": {
                "href": "login.html"
            }
        }
    }) %}

    {% if routes is not empty %}
        <div class="forgot-password">
            {% for route in routes %}
                <a {% for attribute, value in route.attributes %}
                    {% if value is same as(true) %}
                        {{- ' ' ~ attribute -}}
                    {% elseif value is not empty %}
                        {{- attribute -}}="{{- value -}}"
                    {% endif %}
                {% endfor -%}>
                    {{ route.title }}
                </a>
            {% endfor %}
        </div>
    {% endif %}

{% endblock %}

{% block head %}
    {% include 'totem_submodules::totem.module.loadcss/partials/loadcss.twig' with {
        stylesheets: totem_group_auth.stylesheets|default([
            '/resources/modules/totem.module.tipi-base-adapter/stylesheets/totem.module.tipi-base-adapter.css',
            '/resources/modules/totem.module.panel/stylesheets/totem.module.panel.css',
            '/resources/modules/totem.module.button/stylesheets/totem.module.button.css',
            '/resources/modules/totem.module.form/stylesheets/totem.module.form.css',
            '/resources/templates/totem.template.auth/stylesheets/totem.template.auth.css',
            '/resources/groups/totem.group.auth/stylesheets/totem.group.auth.css'
        ])
    } %}
{% endblock %}