{extends file="simple-layout.tpl"}

{* -- We do not check admin login on this page *}
{block name="check-auth"}{/block}

{block name="page-title"}{intl l='Request a new password'}{/block}

{block name="main-title"}{intl l='Request a new password'}{/block}

{block name="main-content"}

    <div class="col-md-offset-3 col-md-6">
        {form name="thelia.admin.lostpassword"}
        <form action="{url path='/admin/password-create-request'}" method="post" {form_enctype}>

            {if $create_request_success}
                <div class="alert alert-success">
                    {intl l='An email containing instructions to create a new password was sent to your email address. If you don\'t receive this email, please try again.'}
                </div>
            {/if}

            {if $token_error}
                <div class="alert alert-danger">
                    {intl l='An invalid token was provided, your password cannot be changed. Please try again, and be sure to use the exact URL which is in the e-mail sent to you.'}
                </div>
            {/if}

            <p>Please enter your username or email address below. You will receive a link to create a new password via email.</p>

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

            <fieldset>
                {form_hidden_fields}

                {form_field field='success_url'}
                    <input type="hidden" name="{$name}" value="{url path='/admin/password-create-request-success'}" />
                {/form_field}

                {form_field field='username_or_email'}
                <div class="form-group {if $error}has-error{/if}">
                    <label for="{$label_attr.for}" class="control-label hidden">{$label} : </label>
                    <div class="input-group">
                        <span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
                        <input type="text" id="{$label_attr.for}" name="{$name}" class="form-control input-lg" title="{$label}" placeholder="{intl l='Username or e-mail address'}" autofocus>
                    </div>
                </div>
                {/form_field}

                <div class="btn-group btn-group-justified">
                    <div class="btn-group">
                        <a href="{url path='/admin/login'}" class="btn btn-link"><span class="hidden-xs glyphicon glyphicon-arrow-left"></span> {intl l='Back'}</a>
                    </div>

                    <div class="btn-group">
                        <button type="submit" class="btn btn-primary btn-lg"><span class="hidden-xs glyphicon glyphicon-cog"></span> {intl l='Generate new password'}</button>
                    </div>
                </div>
            </fieldset>
        </form>
        {/form}
    </div>
{/block}