{extends file="layout.tpl"}

{* Body Class *}
{block name="body-class"}page-login{/block}

{* Breadcrumb *}
{block name='no-return-functions' append}
    {$breadcrumbs = [
    ['title' => {intl l="Reset password" d="resetpassword.fo.default"}, 'url'=>{url path="/reset_password"}]
    ]}
{/block}


{block name="main-content"}

    {* This page should not replace the current previous URL *}
    {set_previous_url ignore_current="1"}

    <div class="main">
        <article class="col-main" role="main" aria-labelledby="main-label">
            <h1 id="main-label" class="page-header">{intl l="Reset password" d="resetpassword.fo.default"}</h1>
            {form name="resetpassword_form_front_reset_password_form"}
                <form class="form-horizontal" action="{url path="/reset_password"}" method="post" {form_enctype} novalidate>
                    {if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}

                    {form_field field='success_url'}
                        <input type="hidden" name="{$name}" value="{url path="/login"}"> {* the url the user is redirected to on login success *}
                    {/form_field}

                    {form_field field='error_url'}
                        <input type="hidden" name="{$name}" value="{navigate to="current"}">
                    {/form_field}

                    {form_field field='error_message'}
                        <input type="hidden" name="{$name}" value="{intl l="missing or invalid data" d="resetpassword.fo.default"}"> {* the url the user is redirected to on login success *}
                    {/form_field}
                    {form_hidden_fields}
                    <fieldset>
                        {form_field field="email"}
                            <input type="hidden" name="{$name}" value="{$smarty.get.email}">
                        {/form_field}
                        {form_field field="token"}
                            <input type="hidden" name="{$name}" value="{$smarty.get.token}">
                        {/form_field}

                        <fieldset id="register-login" class="panel panel-info">
                            <div class="panel-heading">
                                {intl l="Choose your new password" d="resetpassword.fo.default"}
                            </div>

                            <div class="panel-body">
                                {form_field field="password"}
                                    <div class="form-group group-password{if $error} has-error{/if}">
                                        <label class="control-label col-sm-3" for="{$label_attr.for|default:null}">{$label}{if $required} <span class="required">*</span>{/if}</label>
                                        <div class="control-input col-sm-5">
                                            <input type="password" name="{$name}" id="{$label_attr.for|default:null}" class="form-control" autocomplete="off"{if $required} aria-required="true" required{/if}{if !isset($error_focus) && $error} autofocus{/if}>
                                            {if $error }
                                                <span class="help-block">{$message}</span>
                                                {assign var="error_focus" value="true"}
                                            {/if}
                                        </div>
                                    </div><!--/.form-group-->
                                {/form_field}

                                {form_field field="password_confirm"}
                                    <div class="form-group group-password_confirm{if $error} has-error{/if}">
                                        <label class="control-label col-sm-3" for="{$label_attr.for|default:null}">{$label}{if $required} <span class="required">*</span>{/if}</label>
                                        <div class="control-input col-sm-5">
                                            <input type="password" name="{$name}" id="{$label_attr.for|default:null}" class="form-control" autocomplete="off"{if $required} aria-required="true" required{/if}{if !isset($error_focus) && $error} autofocus{/if}>
                                            {if $error }
                                                <span class="help-block">{$message}</span>
                                                {assign var="error_focus" value="true"}
                                            {/if}
                                        </div>
                                    </div><!--/.form-group-->
                                {/form_field}
                            </div>
                        </fieldset>
                    </fieldset>
                    <div class="group-btn">
                        <button type="submit" class="btn btn-primary"><i class="fa fa-chevron-right"></i> {intl l="Reset password" d="resetpassword.fo.default"}</button>
                    </div>
                </form>
            {/form}
        </article>
    </div>
{/block}
