{extends "index.tpl"}

{block content}
   <div class="page-reset {if $body.act == "passw"}page-reset-old{else}page-reset-new{/if}">
      {if $body.act == "passw"}
         {block "login-title-request"}
            <h1>{t}Zapomněl jsem heslo{/t}</h1>
         {/block}
         <div class="page-content">
            {include "block.messages.tpl"}
            {block "textcontent-request"}
               <p>{t}Pokud již máte vytvořený účet, ale zapomněli jste své heslo, zadejte svou e-mailovou adresu, kterou jste uvedli při registraci.{/t}
                  <br>{t}Zašleme Vám na ni e-mail s odkazem pro nastavení nového hesla.{/t}</p>
            {/block}
            <form name="passw" method="post" action="{path('kupshop_user_loginreset_sendemail')}">
               <div class="form-group">
                  <input type="email" name="email" value="{$body.inputEmail}" maxlength="70" class="form-control"
                         id="email" placeholder="{t}E-mail{/t}">
               </div>
               <input type="hidden" name="emailSubmit" value="1">
               <button type="submit" class="btn btn-primary">{t}Odeslat{/t}</button>
            </form>
         </div>
      {elseif $body.act == "get_new"}
         <h1>{t}Nastavení nového hesla{/t}</h1>
         <div class="page-content">
            {include "block.messages.tpl"}
            {block "textcontent-confirm"}
               <p>{t}Vložte své nové heslo.{/t}</p>
            {/block}
            <form name="get_new" method="post"
                  action="{path('kupshop_user_loginreset_changepassword', ['generatePassword' => 1, 'id' => $smarty.get.id, 'request' => $smarty.get.request])}">
               {block "form-confirm"}
                  <div class="form-group">
                     <input type="password" name="password" id="password" class="form-control" value=""
                            data-bv-notempty="true" data-bv-stringlength="true" data-bv-stringlength-min="6" placeholder="{t}Heslo{/t}" autocomplete="new-password">
                  </div>
                  <div class="form-group">
                     <input type="password" name="passwordAgain" id="passwordAgain" class="form-control" value=""
                            data-bv-notempty="true" data-bv-identical="true"
                            data-bv-identical-message="{t}Hesla se neshodují{/t}" data-bv-identical-field="password"
                            placeholder="{t}Heslo znovu{/t}" autocomplete="new-password">
                  </div>
                  <button type="submit" name="passSubmit" value="1" class="btn btn-primary">{t}Nastavit heslo{/t}</button>
               {/block}
            </form>
         </div>
      {/if}
   </div>
{/block}

{block "js-dynamic-load" append}
   {if $body.act == "get_new"}
      {asset_compile}
         <script src="/common/static/bootstrapvalidator/js/bootstrapValidator.js"></script>
         <script src="/common/static/bootstrapvalidator/js/language/{$ctrl.active_language_code}.js"></script>
      {/asset_compile}
   {/if}
{/block}

<script>
   {block onready append}
   {if $body.act == "get_new"}
   $("form[name='get_new']").bootstrapValidator({
      feedbackIcons: {
         valid: 'fc fc-check',
         invalid: 'fc fc-remove',
         validating: 'fc fc-refresh',
      },
   });
   {/if}
   {/block}
</script>
