{% extends "base.html" %}

{% block title %}Neues Passwort setzen{% endblock %}

{% block content %}
<div class="rom-overview">
	<div class="columns">
		<div class="column">
			<div class="box">
				<h1 class="title is-1">Neue Passwort setzen</h1>
                {% if user.is_authenticated %}
                    Du bist gerade eingeloggt!<br/>
                    Wieso willst du dein Passwort zurücksetzen? Bist du betrunken?<br/>
                    Wenn ja dann geh nach hause, ansonsten erstmal
                    <a href="{% url 'logout' %}">ausloggen</a></br>
                {% else %}
					{% if form.non_field_errors %}
						<div class="message is-danger">
							<div class="message-header">
								<strong>Nope!</strong>
							</div>
							<div class="message-body">
								{{ form.non_field_errors }}
							</div>
						</div>
					{% endif %}
                    <form method="post">
					    {% csrf_token %}

                        <div class="field is-horizontal">
                            <div class="field-label is-normal">
                                <label class="label" for="{{form.new_password1.id_for_label}}">{{form.new_password1.label}}</label>
                            </div>
                            <div class="field-body">
                                <div class="field is-narrow">
                                    <div class="control has-icons-left has-icons-right">
                                        <input class="input {% if form.new_password1.errors %}is-danger{% endif %} is-primary"
                                        type="password" name="{{form.new_password1.html_name}}"
                                         id="{{form.new_password1.id_for_label}}" value="{{form.new_password1.value|default_if_none:'' }}" />
                                        <span class="icon is-small is-left">
                                            <i class="fa fa-unlock-alt"></i>
                                        </span>
                                        <span class="icon is-small is-right">
                                            {% if form.new_password1.errors %}
                                            <i class="fa fa-warning"></i>
                                            {% endif %}
                                        </span>
                                    </div>
                                    <p class="help is-danger">
                                        {{form.new_password1.errors.as_text}}
                                    </p>
                                </div>
                            </div>
                        </div>

                        <div class="field is-horizontal">
                            <div class="field-label is-normal">
                                <label class="label" for="{{form.new_password2.id_for_label}}">{{form.new_password2.label}}</label>
                            </div>
                            <div class="field-body">
                                <div class="field is-narrow">
                                    <div class="control has-icons-left has-icons-right">
                                        <input class="input {% if form.new_password2.errors %}is-danger{% endif %} is-primary"
                                        type="password" name="{{form.new_password2.html_name}}"
                                         id="{{form.new_password2.id_for_label}}" value="{{form.new_password2.value|default_if_none:'' }}" />
                                        <span class="icon is-small is-left">
                                            <i class="fa fa-unlock"></i>
                                        </span>
                                        <span class="icon is-small is-right">
                                            {% if form.new_password2.errors %}
                                            <i class="fa fa-warning"></i>
                                            {% endif %}
                                        </span>
                                    </div>
                                    <p class="help is-danger">
                                        {{form.new_password2.errors.as_text}}
                                    </p>
                                </div>
                            </div>
                        </div>

                        <div class="field is-grouped">
                            <p class="control">
                                <button class="button is-primary">Passwort setzen</button>
                            </p>
                        </div>
                    </form>

                {% endif %}
			</div>
		</div>
	</div>
</div>
{% endblock %}
