{% extends "main_django.html" %}
{% load i18n %}

{% block title %}
<title>
{% blocktrans with platform_name=platform_name %}
    Reset Your {{ platform_name }} Password
{% endblocktrans %}
</title>
{% endblock %}

{% block bodyextra %}
<script type="text/javascript" src="{{STATIC_URL}}js/student_account/password_reset.js"></script>
{% endblock %}

{% block bodyclass %}view-passwordreset{% endblock %}

{% block body %}
<div id="password-reset-confirm-container" class="login-register">
    <section id="password-reset-confirm-anchor" class="form-type">
        <div id="password-reset-confirm-form" class="form-wrapper" aria-hidden="true">
            <div class="status submission-error {% if not err_msg %} hidden {% endif %}" aria-live="polite">
                <h4 class="message-title">{% trans "Error Resetting Password" %}</h4>
                <ul class="message-copy">
                {% if err_msg %}
                    <li>{{err_msg}}</li>
                {% else %}
                    <li>{% trans "You must enter and confirm your new password." %}</li>
                    <li>{% trans "The text in both password fields must match." %}</li>
                {% endif %}
                </ul>
            </div>
            {% if validlink %}

            <form role="form" id="passwordreset-form" method="post" action="">{% csrf_token %}
                <div class="section-title lines">
                    <h2>
                        <span class="text">
                        {% trans "Reset Your Password" %}
                        </span>
                    </h2>
                </div>

                <p class="action-label">
                    {% trans "Enter and confirm your new password." %}
                </p>

                <div class="form-field new_password1-new_password1">
                    <label for="new_password1">{% trans "New Password" %}</label>
                    <input id="new_password1" type="password" name="new_password1" placeholder="*****" />
                </div>
                <div class="form-field new_password2-new_password2">
                    <label for="new_password2">{% trans "Confirm Password" %}</label>
                    <input id="new_password2" type="password" name="new_password2" placeholder="*****" />
                </div>

                <button type="submit" class="action action-primary action-update js-reset">{% trans "Reset My Password" %}</button>
            </form>
            {% else %}
            <div class="status submission-error" aria-live="polite">
                <h4 class="message-title">{% trans "Invalid Password Reset Link" %}</h4>
                <ul class="message-copy">
                {% blocktrans with start_link='<a href="/login">' end_link='</a>' %}
                    This password reset link is invalid. It may have been used already. To reset your password, go to the {{ start_link }}sign-in{{ end_link }} page and select <strong>Forgot password</strong>.
                {% endblocktrans %}
                </ul>
            </div>
            {% endif %}
        </div>
    </section>
</div>
{% endblock %}
