{% extends 'base.html' %}
{% block title %} | Set password{% endblock %}

{% block main %}
<div class="page-header">
    <div class="container">
        <h1>Set password</h1>
    </div>
</div>

<div class="container">
    {% include 'snippets/messages.html' %}

    <div class="row">
        <div class="col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3">
            {% if form.errors %}
                <div class="alert alert-danger">
                    <p>An error occurred. Please try again.</p>
                </div>
            {% endif %}

            <form action="{% url 'account_set_password' %}" method="POST" novalidate>
                {% csrf_token %}

                <div class="form-group {% if form.password1.errors %}has-error{% endif %}">
                    <label for="password1">Password</label>
                    <input type="password" class="form-control input-lg" id="password1" name="password1" value="{{ form.data.password1 }}" required />
                    {% if form.password1.errors %}<span class="help-block">{{ form.password1.errors|striptags }}</span>{% endif %}
                </div>

                <div class="form-group {% if form.password2.errors or form.non_field_errors %}has-error{% endif %}">
                    <label for="password2">Repeat password</label>
                    <input type="password" class="form-control input-lg" id="password2" name="password2" value="{{ form.data.password2 }}" required />
                    {% if form.password2.errors %}<span class="help-block">{{ form.password2.errors|striptags }}</span>{% endif %}
                    {% if form.non_field_errors %}<span class="help-block">{{ form.non_field_errors|striptags }}</span>{% endif %}
                </div>

                <div class="form-group">
                    <button type="submit" class="btn btn-lg btn-primary">Set my password</button>
                    <a role="button" href="{% url 'admin:userprofile' %}" class="btn btn-lg btn-link">Cancel</a>
                </div>
            </form>
        </div>
    </div>
</div>
{% endblock %}

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