django-cats/cats/views.py
Jan Dittberner 6b3fce5684 Add basic template and design system
- implement base template and home page template
- add a rudimentary cats.css
- add CAcert logo and favicon resources
- use template in home page view
2024-09-20 13:06:43 +02:00

23 lines
685 B
Python

from django.contrib.auth import authenticate
from django.http import HttpResponseForbidden, HttpResponseRedirect
from django.shortcuts import redirect, render
from django.utils.translation import gettext as _
# Create your views here.
def certificate_login(request):
certificate = request.META.get('HTTP_X_SSL_CERT', None)
user = authenticate(request, encoded_certificate=certificate)
if not user:
return HttpResponseForbidden(_("you have not sent a valid client certificate"))
if "next" in request.GET:
return HttpResponseRedirect(request.GET["next"])
return redirect("home")
def home_page(request):
return render(request, "home.html")