{extends file="layout.tpl"}

{* Security *}
{block name="no-return-functions" prepend}
    {check_auth role="CUSTOMER" login_tpl="login"}
{/block}

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

{* Breadcrumb *}
{block name='no-return-functions' append}
    {$breadcrumbs = [
        ['title' => {intl l="Account"}, 'url'=>{url path="/account"}],
        ['title' => {intl l="Change Password"}, 'url'=>{url path="/account/password"}]
    ]}
{/block}

{block name="main-content"}

    <div class="main">

        <article class="col-main" role="main" aria-labelledby="main-label">

            <h1 id="main-label" class="page-header">{intl l="Change Password"}</h1>

            {hook name="account-password.top"}
            {form name="thelia.front.customer.password.update"}
            <form id="form-register" class="form-horizontal" action="{url path="/account/password"}" method="post">
                {form_field field='success_url'}
                    <input type="hidden" name="{$name}" value="{url path="/account"}" />
                {/form_field}

                {form_hidden_fields}

                {if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}

                <fieldset id="register-info" class="panel panel-default">
                    <div class="panel-heading">
                        {intl l="Login Information"}
                    </div>

                    <div class="panel-body">
                        {form_field field="password_old"}
                        <div class="form-group group-password_old{if $error} has-error{/if}">
                            <label class="control-label col-sm-3" for="{$label_attr.for}">{$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}" class="form-control" maxlength="255" value="{$value}" {if $required} aria-required="true" required{/if}{if !$value || $error} autofocus{/if}>
                                {if $error}
                                    <span class="help-block">{$message}</span>
                                    {assign var="error_focus" value="true"}
                                {elseif !$value}
                                    {assign var="error_focus" value="true"}
                                {/if}
                            </div>
                        </div><!--/.form-group-->
                        {/form_field}

                        {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}">{$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}" class="form-control" maxlength="255" value="{$value}" {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}">{$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}" class="form-control" maxlength="255" autocomplete="off"{if $required} aria-required="true" required{/if}{if !isset($error_focus) && $error} autofocus{/if}>
                                {if $error }
                                    <span class="help-block">{$message}</span>
                                {/if}
                            </div>
                        </div><!--/.form-group-->
                        {/form_field}
                    </div>
                </fieldset>

                <div class="form-group group-btn">
                    <div class="control-btn col-sm-5 col-sm-offset-3">
                        <button type="submit" class="btn btn-primary"><i class="fa fa-chevron-right"></i> {intl l="Change Password"}</button>
                    </div>
                </div><!--/.form-group-->
            </form>
            {/form}
            {hook name="account-password.bottom"}
        </article>

    </div><!-- /.layout -->
{/block}

{block name="stylesheet"}
{hook name="account-password.stylesheet"}
{/block}

{block name="after-javascript-include"}
{hook name="account-password.after-javascript-include"}
{/block}

{block name="javascript-initialization"}
{hook name="account-password.javascript-initialization"}
{/block}
