byceps/blueprints/admin/core/templates/layout/admin/_current_user.html
{%- from 'macros/icons.html' import render_icon %}
{%- from 'macros/user.html' import render_user_avatar, render_user_screen_name %}
<div class="current-user">
{%- if g.user.authenticated %}
<div class="dropdown">
<a href="{{ url_for('user_admin.view', user_id=g.user.id) }}" class="dropdown-toggle button button--clear">
{{ render_user_avatar(g.user, size=32) }}
</a>
<ol class="dropdown-menu dropdown-menu--right">
<li>
<span class="dropdown-label label-and-name">
<span class="label">{{ _('Logged in as') }}</span>
<span class="name">{{ render_user_screen_name(g.user) }}</span>
</span>
</li>
<li class="dropdown-divider"></li>
<li><a class="dropdown-item" href="{{ url_for('user_admin.view', user_id=g.user.id) }}">{{ render_icon('user-profile') }} {{ _('Profile') }}</a></li>
<li><a class="dropdown-item" href="{{ url_for('authn_password.update_form') }}">{{ render_icon('password') }} {{ _('Change password') }}</a></li>
<li class="dropdown-divider"></li>
<li><a class="dropdown-item" data-action="log-out" data-redirect-target="{{ url_for('authn_login_admin.log_in') }}" href="{{ url_for('authn_login_admin.log_out', _method='POST') }}">{{ render_icon('log-out') }} {{ _('Log out') }}</a></li>
</ol>
</div>
{%- else %}
<a class="button button--clear" href="{{ url_for('authn_login_admin.log_in_form') }}">{{ render_icon('log-in') }} <span>{{ _('Log in') }}</span></a>
{%- endif %}
</div>