Skip to content

Commit ccff0d9

Browse files
committed
Add basic check_my_auth view
1 parent 83dcb30 commit ccff0d9

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/community_db/views.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from django.db import models
2-
from django.http import HttpResponseRedirect
2+
from django.http import HttpResponse, HttpResponseRedirect
33
from django.shortcuts import get_object_or_404, render
44
from django.urls import reverse
55
from django.views.generic import DetailView, ListView, UpdateView
@@ -90,3 +90,12 @@ class PersonUpdateView(UpdateView):
9090

9191
def get_success_url(self):
9292
return reverse("cbv-person-detail", args=[self.object.id])
93+
94+
95+
def check_my_auth(request):
96+
output = ["<html><body>"]
97+
output.append(f"Is anonymous: {request.user.is_anonymous}")
98+
output.append(f"Is authenticated: {request.user.is_authenticated}")
99+
output.append(f"Username: {request.user.username}")
100+
output.append("</body></html>")
101+
return HttpResponse("<br>".join(output))

src/pacificconnect/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
urlpatterns = [
2222
path("admin/", admin.site.urls),
23+
path("check-my-auth/", views.check_my_auth),
2324
path("fbv/people/", views.list_persons_with_template, name="fbv-person-list"),
2425
path(
2526
"fbv/people/<int:pk>/",

0 commit comments

Comments
 (0)