[%- WRAPPER private/auth_wrapper.html 
  title = 'Password Reset'
-%]

[% ensure_logged_out %]
          
<div class="cf" style="height:80px;">
  <h2 class="lb_ribbon lb_blue">
    <div style="padding-top:3px;">
      <img 
        src="[% mount_url %]/assets/rapidapp/misc/static/images/iconLoggedOut.png" 
        style="vertical-align:middle;padding-bottom:5px;padding-right:9px;"
      />
      <span style="padding-right:11px;font-weight:bold;font-size:1.1em;">Password Reset</span>
    </div>
  </h2>
  
  <a href="[%- mount_url -%]/" class="right small sl_link">
    <span>Home</span>
  </a>
  
  <a href="[%- mount_url -%]/auth/login" class="right small sl_link">
    <span>Sign in</span>
  </a>


</div>

[% IF local_info.error %]
  <div style="font-size:1.1em;font-weight:bold;color:red;padding:10px;">
    <center>&nbsp;[% local_info(clear).message %]&nbsp;</center>
  </div>
  <br>
[% END %]

<div class="row m_cont">
  <div class="eight columns centered">
  
    [% IF BlogCfg.enable_password_reset %]
      <div class="l_pane">
        [% IF local_info.finished %]
          [% IF local_info(clear).failed %]
            <h3>Password reset has failed!</h3>
          [% ELSE %]
            <h3>Password reset.</h3>
          [% END %]
        [% ELSIF local_info.key %]
        
          Enter your new password:
          
          <br><br>
          
          <form 
              action="[% remote_action_path %]/password_reset?key=[% local_info(clear).key %]&using=local_info" 
              method="post" class="nice"
            >

            <div class="sepH_c">
              <div class="elVal">
                <label for="new_password">New password:</label>
                <input autofocus
                  class="oversize expand input-text" 
                  type="password" 
                  id="new_password"  
                  name="new_password" 
                />
              </div>
            </div>

            <div class="cf" style="padding-bottom:30px;">
              <input 
                class="button small radius right black"
                type="submit"  
                value="Submit" 
              />
            </div>
        

        [% ELSIF local_info.success %]
          [% local_info(clear).message || 'Success - reset link sent' %]
          <br><br>
        [% ELSE %]

          Enter your username or e-mail address below to receive a one-time link
          to reset your password:
          
          <br><br>
          
          <form 
              action="[% remote_action_path %]/password_reset?using=local_info" 
              method="post" class="nice"
            >

            <div class="sepH_c">
              <div class="elVal">
                <label for="username">Username or E-Mail address:</label>
                <input autofocus
                  class="oversize expand input-text" 
                  type="text" 
                  id="username"  
                  name="username" 
                />
              </div>
            </div>

            <div class="cf" style="padding-bottom:30px;">
              <input 
                class="button small radius right black"
                type="submit"  
                value="Request Reset" 
              />
            </div>

          </form>
        
        [% END %]
      </div>
    [% ELSE %]
      <br>
      <h5>Password reset is not enabled.</h5>
      <br>
      <h6>Contact your system administrator.</h6>
      
      <br><br><br><br>
    
    [% END %]
    
  </div>
</div>
            
[% END %]