{% extends 'yaccounts/base.html' %}

{% load i18n %}

{% load staticfiles %}

{% block title %}{% trans 'Reset Password' %}{% endblock %}

{% block body %}

<div class="container">
  <div class="row">
    <div class="col-sm-6 col-md-4 col-md-offset-4">
      <h1 class="text-center login-title">{% trans 'Account Recovery' %}</h1>
      
      <!-- Frame -->
      <div class="account-wall">

        <img class="profile-img" src="{% static 'yaccounts/images/avatar_default.png' %}" alt="Avatar">
        
        <!-- Django Messages -->
        {% include 'yaccounts/django_messages.html' %}

        <!-- Email Login -->
        <form class="form-signup" method="POST" action="{% url 'yaccounts:reset' %}">
          {% csrf_token %}

          <!-- Email -->
          <input type="text" class="form-control" placeholder="{% trans 'Email' %}" name="email" value="{{ email }}" required autofocus>
          <br>
          
          <!-- Submit -->
          <button class="btn btn-lg btn-default btn-primary btn-block" type="submit">{% trans 'Reset password' %}</button>

          <span class="clearfix"></span>
        </form>
      
      </div>

      {% if user.is_authenticated %}
        <a href="{% url 'yaccounts:index' %}" class="text-center new-account">{% trans 'Back to account settings' %}</a>
      {% else %}
        <a href="{% url 'yaccounts:login' %}" class="text-center new-account">{% trans 'Back to login' %}</a>
      {% endif %}

    </div>
  </div>
</div>

{% endblock %}

{% block javascript %}
  <script>
      $(document).ready(function() {
          $('.form-signup button[type="submit"]').on('click', function() { $('.form-signup button[type="submit"]').attr('disabled', true); $('.form-signup').submit(); } );
      });    
  </script>
{% endblock %}