<!-- default admin user change password page -->
{% extends 'default.html' %}

{% block auth %}
  <div class="pkg_desc">
    <h1>Change user password</h1>
  </div>
  <div class="admin_auth_form">
    {% if context.form %}
      <!-- if user is using wtforms template in the `auth.route` views, this is the form that is going to be used -->
      <form method="POST" action="">
        {{ context.form.csrf_token }}
        <!-- reference about csrf_token -->
        {#
          If whether we use:
            {{ context.form.csrf_token }}
          or we use:
            {{ context.form.hidden_tag() }}
          all the two is thesame
        #}


        {% if context.form.old_password.errors %}
          {{ context.form.old_password(placeholder="Enter old password") }}
          <!-- we commented the error -->
          {#
            <div class="invalid-feedback">
              {% for error in context.form.old_password.errors %}
                <span>{{ error }}</span>
              {% endfor %}
            </div>
          #}
        {% else %}
          {{ context.form.old_password(placeholder="Enter old password") }}
        {% endif %}
        

        {% if context.form.password1.errors %}
          {{ context.form.password1(placeholder="Enter password") }}
          <!-- we commented the error -->
          {#
            <div class="invalid-feedback">
              {% for error in context.form.password1.errors %}
                <span>{{ error }}</span>
              {% endfor %}
            </div>
          #}
        {% else %}
          {{ context.form.password1(placeholder="Enter password") }}
        {% endif %}
        

        {% if context.form.password2.errors %}
          {{ context.form.password2(placeholder="Confirm password") }}
          <!-- we commented the error -->
          {#
            <div class="invalid-feedback">
              {% for error in context.form.password2.errors %}
                <span>{{ error }}</span>
              {% endfor %}
            </div>
          #}
        {% else %}
          {{ context.form.password2(placeholder="Confirm password") }}
        {% endif %}
        <button type="submit">Change Password</button>
        <p>
          <a href="#" class="a_links">Forgot password</a>
        </p>
      </form>
    {% else %}
      <!-- if user is not using wtforms template in the `auth.route` views, this is the form that is going to be used (if using html page template) -->
      <form action="" method="POST">
        <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
        <input type="password" name="old_password" placeholder="Enter old password" minlength="6" required>
        <input type="password" name="password1" placeholder="Enter password" minlength="6" required>
        <input type="password" name="password2" placeholder="Confirm password" minlength="6" required>
        <button type="submit">Change Password</button>
        <p>
          <a href="#" class="a_links">Forgot password</a>
        </p>
      </form>
    {% endif %}
  </div>
{% endblock auth %}
