{% extends "auth_base.html" %}
{% block title %}Change password{% endblock %}
{% block page %}
{% if ok %}
    <form>
    <div class="ok">Password changed.</div>
    <fieldset>
    <a href="{{ sign_in_redirect }}">Click here to continue.</a>
    </fieldset>
    </form>
{% else %}
    <form action="" method="post" accept-charset="utf-8">
    {% if errors -%}
      <div class="error"><ul>
      {% if 'FAIL' in errors -%}
        <li>Your current password isn't rigth.</li>
      {%- endif %}
      {% if 'TOO SHORT' in errors -%}
        <li>The password is too short <br>(must be at least <code>{{ auth.settings.password_minlen }}</code> chars long).</li>
      {%- endif %}
      {% if 'MISMATCH' in errors -%}
        <li>The password doesn't match the confirmation.</li>
      {%- endif %}
      </ul></div>
    {%- endif %}

    <h1>Reset password</h1>
    {% if user_requested -%}
    <label for="password">Current password<br>
    <input type="password" name="password" id="password" size="20" maxlength="254" tabindex="1">
    </label>
    {%- endif %}
    <label for="new_password_1">New password<br>
    <input type="password" name="new_password_1" id="new_password_1" size="20" maxlength="254" tabindex="2">
    </label>
    <label for="new_password_2">Confirm new password<br>
    <input type="password" name="new_password_2" id="new_password_2" size="20" maxlength="254" tabindex="3">
    </label>

    <fieldset>
    <a href="{% if user_requested %}javascript:history.back(1){% else %}/{% endif %}" tabindex="5">Cancel</a>
    {{ csrf_secret.input }}
    <button type="submit" tabindex="4">Change password &raquo;</button>
    </fieldset> 

    </form>
{%- endif %}
{% endblock %}
