{% extends "wedding/blocks/base.html" %}
{% load static %}

{% block title %}
Login
{% endblock %}

{% block content %}
<div id="login" class="container-fluid text-center page-container">
    <h1 class="page-header">Account Login</h1>

    {% if form.errors %}
        <div class="alert alert-danger">
            <strong>Error logging in. Please try again.</strong>
        </div>
    {% elif next != "/" %}
        <div class="alert alert-warning">
            <strong>Please log in or RSVP to view this page. Thank you!</strong>
        </div>
    {% endif %}

    <div class="row">
        <div class="col-sm-6 base-font text-center">
            <div align="center">
                <h2>Already RSVP'd? Login</h2>
                    <form method="post" action="{% url 'login' %}">
                    {% csrf_token %}
                    <table>
                    <tr>
                        <td class="login-box login-text">Email Address:</td>
                        <td class="login-box">{{ form.username }}</td>
                    </tr>
                    <tr>
                        <td class="login-box login-text">Password:</td>
                        <td class="login-box">{{ form.password }}</td>
                    </tr>
                    </table>

                    <input type="submit" class="login-button" value="Log In" />
                    <input type="hidden" name="next" value="{{ next }}" />
                    </form>

                    <p><a href="{% url 'password_reset' %}">Forgot password?</a></p>
            </div>
        </div>
        <div class="col-sm-6 base-font text-center">
            <div align="center">
                <h2>RSVP</h2>
                    <p>
                        Welcome to our wedding site!
                        <br><br>
                        <a class="btn btn-primary" href="{% url 'create-account' %}">Submit your RSVP</a>
                        <br><br>
                        Whether you can join us for the wedding or not, we need to find your RSVP to allow access to the more personal parts of the website.
                    </p>
            </div>
        </div>
    </div>
</div>

{% endblock %}
