{% extends "../body.html" %}
{% load util %}
{% load static %}
{% block content %}
    {% if user.is_authenticated %}
        <a href="/">
            <button type="button" class="btn btn-primary">Home</button>
        </a>
    {% else %}
        <div align="center" style="display: block;">
            <img src="{% get_logo %}" alt="" onerror="this.style.display='none'" class="aw-img-float"/>
        </div>
        <div class="aw-login">
            {% if form.errors %}
                {% for field in form %}
                    {% for error in field.errors %}
                        <div class="alert alert-danger">
                            <strong>{{ error|escape }}</strong>
                        </div>
                    {% endfor %}
                {% endfor %}
                {% for error in form.non_field_errors %}
                    <div class="alert alert-danger">
                        <strong>{{ error|escape }}</strong>
                    </div>
                {% endfor %}
            {% endif %}
            {% if not user.is_authenticated %}
                <div class="alert alert-info">
                    Please login to see this page.
                </div>
            {% endif %}
            <br>
            <form method="post" action="/a/saml/init/">
                {% csrf_token %}
                <label for="id_username" class="aw-login-fields">
                    Username:
                    <input class="aw-login-fields form-control" type="text" name="username" autofocus="" autocapitalize="none" autocomplete="username" maxlength="150" required="" id="id_username">
                </label>
                <div class="aw-login-btn">
                    <button type="submit" value="login" class="btn btn-primary">Login</button>
                    <a href="/a/login/fallback/">
                        <button type="button" class="btn btn-secondary">Local User</button>
                    </a>
                </div>
            </form>
        </div>
    {% endif %}
{% endblock %}