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

{% import "macro_functions.phtml" as mf %}

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

{% block content %}
    <div class="h-block">
        <div class="h-block-header">
            <div class="icon"><span class="icon-mail"></span></div>
            <h2>{{ 'How to reset my password?'|trans }}</h2>
            <p>{{ 'Enter your email to reset password. You will receive new password after reset link is confirmed.'|trans }}</p>
        </div>
        <div class="block">
            <form action="" method="post" id="password-reset">
                <fieldset>
                    <legend>{{ 'Reset password'|trans }}</legend>
                    <label>{{ 'Email Address'|trans }}: </label>
                    <input type="email" name="email" value="{{ request.email }}" required="required">
                    <input class="bb-button bb-button-submit" type="submit" value="{{ 'Reset password'|trans }}">
                </fieldset>
            </form>
        </div>
    </div>

{% endblock %}

{% block js %}
<script type="text/javascript">
$(function() {
    $('#password-reset').bind('submit', function(event) {
        bb.post(
            'guest/client/reset_password',
            $(this).serialize(),
            function(result) {
                bb.msg('{{ 'Password reset confirmation email was sent'|trans }}');
            }
        );
        
        return false;
    });
});
</script>
{% endblock %}
