Add account settings page with YouTube connection management and user update functionality

This commit is contained in:
Edgar P. Burkhart 2025-06-15 11:19:12 +02:00
parent da1c750771
commit cd0ca2f5ea
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
7 changed files with 62 additions and 8 deletions

View file

@ -4,13 +4,8 @@
<h1>
<i class="ri-music-ai-fill"></i> Musik
</h1>
<p>Bienvenue {{ user.username }} !</p>
<p>
{% if not user.youtubecredentials.credentials %}
<a href="{% url "youtube_login" %}" role="button"><i class="ri-youtube-fill"></i> Me connecter au compte Youtube</a>
{% else %}
<i class="ri-youtube-fill"></i> Connecté au compte Youtube <strong>{{ user.youtubecredentials.title }}</strong>.
{% endif %}
Bienvenue <strong>{{ user.username }}</strong> !
</p>
<h2>
<i class="ri-group-2-fill"></i> Mes groupes

View file

@ -52,6 +52,7 @@ urlpatterns = [
),
path("group/game/<int:pk>/", views.GameDetailView.as_view(), name="game_detail"),
path("youtube_login/", views.YoutubeLoginView.as_view(), name="youtube_login"),
path("youtube_logout/", views.YoutubeLogoutView.as_view(), name="youtube_logout"),
path(
"youtube_callback/",
views.YoutubeCallbackView.as_view(),

View file

@ -405,6 +405,12 @@ class YoutubeLoginView(LoginRequiredMixin, View):
return redirect(auth_url)
class YoutubeLogoutView(LoginRequiredMixin, View):
def post(self, request):
request.user.youtubecredentials.delete()
return redirect("account_settings")
class GroupClearBlacklistView(MemberFilterMixin, SingleObjectMixin, View):
model = models.Group