Add Twitch auth with django-allauth

This commit is contained in:
2024-08-15 06:13:40 +02:00
parent d4d8567ef8
commit 324f255a8e
10 changed files with 367 additions and 61 deletions

View File

@ -1,3 +1,4 @@
{% load socialaccount %}
<header class="d-flex justify-content-between align-items-center py-3 border-bottom">
<h1 class="h2">
<a href='{% url "index" %}' class="text-decoration-none nav-title">Twitch drops</a>
@ -16,6 +17,18 @@
<li class="nav-item d-none d-sm-block">
<a class="nav-link" href="https://github.com/sponsors/TheLovinator1">Donate</a>
</li>
{% if not user.is_authenticated %}
<li>
<a class="nav-link" href="{% provider_login_url 'twitch' %}">Login with Twitch</a>
</li>
{% else %}
<li>
<form action="{% url 'account_logout' %}" method="post">
{% csrf_token %}
<button type="submit" class="btn btn-link nav-link">Logout</button>
</form>
</li>
{% endif %}
</ul>
</nav>
</header>