<div id="profile" class="dropdown pull-right">{% load i18n %}
{% if user.is_authenticated %}
	<form method="post" action="{% url 'account_logout' %}" class="logout">
		{% csrf_token %}
		<input type="hidden" name="next" value="{{ request.path }}">
	</form>
	<a id="profile-label" role="button" data-toggle="dropdown" data-target="#" href="/profile">
		{% if user.get_avatar_url %}<img src="{{ user.get_avatar_url }}" class="gravatar">{% else %}<span class="glyphicon glyphicon-user gravatar"></span>{% endif %}
		{{ user }} <span class="caret"></span></a>
	<ul class="dropdown-menu" role="menu" aria-labelledby="profile-label">
		<li><a href="{% if user.get_profile_url %}{{ user.get_profile_url }}{% else %}{% url 'admin:index' %}auth/user/{{ user.id }}{% endif %}"
			   title="{{ user }} ({% firstof user.get_provider 'system' %})"
				><span class="glyphicon glyphicon-user"></span>  {% trans "User Profile" %}</a></li>
		<li><a href="{% url 'account_logout' %}?next={{ request.path }}" class="logout"
				><span class="glyphicon glyphicon-off"></span> {% trans "Log out" %}</a></li>
	</ul>
{% else %}
	<a id="profile-label" href="{% url 'account_login' %}?next={{ request.path }}"
			><span class="glyphicon glyphicon-off"></span> {% trans "Login" %}</a>
{% endif %}
</div>
