{% comment %}
{% if user.is_anonymous %}
  <p>Hello, guest | <a href="{% url auth_login %}">Log in</a></p>
{% else %}
  <p>Hello, {{user.username}} | <a href="{% url webidprovider-logout %}">Log out</a></p>
{% endif %}
{% endcomment %}

{% if not user.is_anonymous %}
<a href="/logout" onclick="return logout();">logout</a>
{% else %}
Hi, anonymous. We are legion.
{% endif %}

<script type="text/javascript">
function logout(elem) {
   if (document.all == null) {
      if (window.crypto) {
          try{
              window.crypto.logout();
              return false; //firefox ok -- no need to follow the link
          } catch (err) {//Safari, Opera, Chrome -- try with tis session breaking
          }
      } else { //also try with session breaking
      }
   } else { // MSIE 6+
      document.execCommand('ClearAuthenticationCache');
      return false;
   };
   return true
}

function login(elem)  { logout(elem) }
</script>
