Jan Dittberner
6b3fce5684
- implement base template and home page template - add a rudimentary cats.css - add CAcert logo and favicon resources - use template in home page view
23 lines
685 B
Python
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")
|