{% extends "base.html" %}

{% block title %} | Reset password{% endblock %}
{% block bodydata %} class="login" {% endblock %}

{% block main %}
        <div class="container">
            <div class="row">
                <div class="col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3">
                    <h3 class="header">{% if token_fail %}Bad Token{% else %}Set your new password{% endif %}</h3>

                    {% if token_fail %}
                        {% url 'account_reset_password' as passwd_reset_url %}
                        <div class="alert alert-danger">The password reset link was invalid, possibly because it has already been used.  Please request a <a href="{{ passwd_reset_url }}">new password reset</a>.</div>
                    {% else %}

                    {% if form.errors %}
                    <div class="alert alert-danger">
                        <strong>We were not able to change the password: </strong>
                        {{ form.password1.errors }}
                        {{ form.password2.errors }}
                    </div>
                    {% endif %}

                    <form action="." method="post" novalidate>
                        {% csrf_token %}
                        <div class="form-group">
                            <label for="password1">New password</label>
                            <input type="password" class="form-control input-lg" name="password1" id="password1" required>
                        </div>
                        <div class="form-group">
                            <label for="password2">Repeat new password</label>
                            <input type="password" class="form-control input-lg" name="password2" id="password2" required>
                        </div>
                        <div class="form-group">
                            <button type="submit" class="btn btn-primary">Change my password</button>
                        </div>
                    </form>
                    {% endif %}
                </div>
            </div>
        </div>
{% endblock %}

{% block libraries %}
            <script src="/static/js/admin.ui.forms.validate.js"></script>
{% endblock %}
