SSO login
and example env file
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
{% if user.is_authenticated %}
|
||||
<p>Current user: {{ user.email }}</p>
|
||||
<form action="{% url 'oidc_logout' %}" method="post">
|
||||
{% csrf_token %}
|
||||
<input type="submit" value="logout">
|
||||
</form>
|
||||
{% else %}
|
||||
<a href="{% url 'oidc_authentication_init' %}">Login</a>
|
||||
{% endif %}
|
||||
+2
-1
@@ -4,5 +4,6 @@ from . import views
|
||||
urlpatterns = [
|
||||
path('track/<str:spotify_id>', views.TrackDetailView.as_view()),
|
||||
path('track', views.NominateView.as_view()),
|
||||
path('', views.TrackListView.as_view()),
|
||||
#path('', views.TrackListView.as_view()),
|
||||
path('', views.AuthView.as_view()),
|
||||
]
|
||||
|
||||
+4
-3
@@ -11,6 +11,10 @@ spt = spotify.Spotify()
|
||||
|
||||
# TODO auth mixins
|
||||
|
||||
class AuthView(View):
|
||||
def get(self, request):
|
||||
return TemplateResponse(request, "Login.html", {})
|
||||
|
||||
class TrackListView(View):
|
||||
def get(self, request):
|
||||
return HttpResponse("..")
|
||||
@@ -40,7 +44,6 @@ class NominateView(View):
|
||||
# Album artists
|
||||
album_artists = []
|
||||
for artist in json["album"]["artists"]:
|
||||
#album_artists.append(Artist.objects.from_json(artist))
|
||||
album_artists.append(from_json(Artist, artist))
|
||||
del json["album"]["artists"]
|
||||
|
||||
@@ -53,12 +56,10 @@ class NominateView(View):
|
||||
# Track artists
|
||||
track_artists = []
|
||||
for artist in json["artists"]:
|
||||
#track_artists.append(Artist.objects.from_json(artist))
|
||||
track_artists.append(from_json(Artist, artist))
|
||||
del json["artists"]
|
||||
|
||||
# Track
|
||||
#track = Track.objects.from_json(json)
|
||||
track = from_json(Track, json)
|
||||
for artist in track_artists:
|
||||
track.artists.add(artist)
|
||||
|
||||
Reference in New Issue
Block a user