{% extends "participant/base_participant.html" %}

{% load i18n %}
{% load staticfiles %}

{% block mainmenu %}
    <ul>
        <li class="selected"><a href="{% url user_login %}" title="">{% trans "Login" %}</a></li>
    </ul>
{% endblock %}

{% block submenu %}
{% endblock %}

{% block content %}
    <h1>{% trans "Login" %}</h1>

    {% if form.errors %}
        <div class="notification error">
            <a class="close" href="#">
            <img alt="close" title="{% trans 'Close this notification' %}" src="{% static 'images/icons/cross.png' %}">
            </a>
            {% for msg in form.non_field_errors %}
                <em>{{ msg }}</em>
                {% if not forloop.last %}<br />{% endif %}
            {% empty %}
                <em>{% trans "Your username and password were not accepted. Please try again." %}</em>
            {% endfor %}
        </div>
    {% endif %}
    {% if first_time_message %}
        <div class="notification info">
            <a class="close" href="#">
            <img alt="close" title="{% trans 'Close this notification' %}" src="{% static 'images/icons/cross.png' %}">
            </a>
            <em>{{ first_time_message|safe }}</em>
        </div>
    {% endif %}
    <script>
        $("div.notification").click(function () {
            $(this).hide("fast");
        });
    </script>
    <form method="post" action="{% url user_login %}{% if next %}?next={{ next }}{% endif %}">
        {% csrf_token %}
        <table>
        <tr>
            <td>{{ form.username.label_tag }}</td>
            <td>{{ form.username }}</td>
        </tr>
        <tr>
            <td>{{ form.password.label_tag }}</td>
            <td>{{ form.password }}</td>
        </tr>
        </table>
        <p>
        <button class="button" type="submit">
            <span class="icon ok">{% trans 'Login' %}</span>
        </button>
        {% if os_enable_anonymous_login %}
        <button class="button" id="anonymous_login">
            <span class="icon guest">{% trans 'Continue as guest' %}</span>
        </button>
        {% endif %}
        <input type="hidden" name="next" value="{{ next }}" />
        </p>
    </form>
    {% if os_enable_anonymous_login %}
        <script>
            $("#anonymous_login").live('click', function () {
                window.location.href = '{% url item_overview %}';
                return false;
            });
        </script>
    {% endif %}
{% endblock %}
