{% load i18n mezzanine_tags accounts_tags %}

{% if request.user.is_authenticated %}
    <p>
    {% trans "Logged in as: " %}
    {% url "profile" request.user.username as profile_url %}
    {% if profile_url %}
        <a href="{{ profile_url }}">{{ request.user|username_or:"email" }}</a>
    </p>
        <a href="{% url "profile_update" %}" class="btn btn-default btn-sm btn-account">
            <span class="glyphicon glyphicon-edit"></span> {% trans "Update profile" %}</a>
    {% else %}
        <a href="{% url "profile_update" %}">{{ request.user|username_or:"email" }}</a>
    </p>
    {% endif %}
    <a href="{% url "logout" %}?next={{ request.path }}" class="btn btn-sm btn-danger btn-account">
        <span class="glyphicon glyphicon-log-out"></span> {% trans "Log out" %}</a>
{% else %}
    <a href="{% url "login" %}?next={{ request.path }}" class="btn btn-default btn-sm btn-account">
        <span class="glyphicon glyphicon-log-in"></span> {% trans "Log in" %}</a>
    &nbsp;{% trans "or" %}&nbsp;
    <a href="{% url "signup" %}?next={{ request.path }}" class="btn btn-default btn-sm btn-account">
        <span class="glyphicon glyphicon-edit"></span> {% trans "Sign up" %}</a>
{% endif %}
