Simple extract of index.html:
<div class="sign-in">
{% if user %}
[Passing the url we have the opportunity to logout the user]
<a href="{{ url|safe }}">LOG OUT</a>
[You can include here operations for user authenticated]
{% else %}
[Passing the url we have the opportunity to login the user]
<a href="{{ url|safe }}">SIGN IN</a>
{% endif %}
</div>
This is a simple example of how the operation is used on the index.html page.