{% extends request.ajax ? 'layout_blank.phtml' : 'layout_default.phtml' %}

{% block meta_title %}{{ 'Reset password'|trans }}{% endblock %}

{% block content_before %}
    <div class="row">
        <div class="col">
            <h1>{{ 'Reset password'|trans }}</h1>
            <ol class="breadcrumb">
                <li class="breadcrumb-item">
                    <a href="{{ ''|link }}">{{ 'Home'|trans }}</a>
                </li>
                <li class="breadcrumb-item active" aria-current="page">{{ 'Reset password'|trans }}</li>
            </ol>
        </div>
    </div>
{% endblock %}

{% block content %}
    {% if not client %}
        <form method="post" class="api-form form-inline" data-api-url="guest/client/reset_password" data-api-msg="{{ 'Password reset confirmation email was sent'|trans }}">
            <p class="text-secondary">{{ 'Enter your email to reset password. You will receive new password after reset link is confirmed.'|trans }}</p>
            <div class="col-md-8 col-xl-6 mx-auto">
                <div class="mb-3">
                    <label class="form-label" for="inputEmail">{{ 'Email address'|trans }}:</label>
                    <input class="form-control" type="email" id="inputEmail" name="email" value="{{ request.email }}" required>
                </div>
                <div class="d-grid gap-2">
                    <button class="btn btn-primary" type="submit">{{ 'Reset password'|trans }}</button>
                    <button class="btn btn-link" data-bs-toggle="modal" data-bs-target="#login">{{ 'I remembered password'|trans }}</button>
                </div>
            </div>
        </form>
    {% else %}
        <script>
            window.location.replace("{{ 'client/me'|link }}");
        </script>
    {% endif %}
{% endblock %}
