Add account settings page with YouTube connection management and user update functionality
This commit is contained in:
parent
da1c750771
commit
cd0ca2f5ea
7 changed files with 62 additions and 8 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue