{% if user.is_authenticated() %}
    <div class="user-state">
        {% include 'socialaccount/snippets/login_service_icon.html' %}
        <ul>
            <li><a href="{{ request.user.get_absolute_url() }}">{{ user_display(request.user) }}</a></li>
            <li><a href="{{ url('account_logout') }}?next={{ next_url }}">{{ _('Sign out') }}</a></li>
        </ul>
    </div>
{% else %}

    {% if waffle.flag('github_login') %}
        {% set github_url = provider_login_url('github', next=next_url) %}
    {% endif %}

    <form>
      <div class="oauth-login-container">
          <div class="oauth-login-options" tabIndex="0">
              <span class="oauth-login-options-text">{{ _('Sign in with') }}</span>
              <span class="oauth-icon oauth-persona launch-persona-login" data-service="Persona" data-next="{{ next_url }}" title="{{ _('Persona') }}"><i class="icon-user" aria-hidden="true"></i></span>
            {% if waffle.flag('github_login') %}
              <span class="oauth-icon oauth-github" data-service="GitHub" data-href="{{ github_url }}" title="{{ _('GitHub') }}"><i class="icon-github" aria-hidden="true"></i></span>
            {% endif %}
          </div>
          <div class="submenu oauth-login-picker" aria-hidden="true">
              <ul>
                  <li><a href="{{ url('account_login') }}" class="login-link launch-persona-login" data-next="{{ next_url }}" data-service="Persona"><i class="icon-user" aria-hidden="true"></i>Persona</a></li>
                {% if waffle.flag('github_login') %}
                  <li><a href="{{ github_url }}" class="login-link" data-service="GitHub"><i class="icon-github" aria-hidden="true"></i>GitHub</a></li>
                {% endif %}
              </ul>
          </div>
      </div>
    </form>
{% endif %}
