broken version, still working on authentification

This commit is contained in:
Benni Bärmann 2020-10-28 15:49:18 +01:00
parent a0c57c7d4d
commit fa41a93325
2 changed files with 7 additions and 3 deletions

View File

@ -19,4 +19,5 @@ from django.urls import path, include
urlpatterns = [ urlpatterns = [
path('', include("input.urls")), path('', include("input.urls")),
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('accounts/', include('django.contrib.auth.urls')),
] ]

View File

@ -8,6 +8,8 @@ from django.core.mail import send_mail, BadHeaderError
from django.conf import settings from django.conf import settings
from django.template.loader import get_template from django.template.loader import get_template
from django.template import Context from django.template import Context
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from .forms import ProjectForm, ExternForm, LibraryForm, IFGForm, LiteratureForm,\ from .forms import ProjectForm, ExternForm, LibraryForm, IFGForm, LiteratureForm,\
HonoraryCertificateForm, InternForm, TravelForm, EmailForm,\ HonoraryCertificateForm, InternForm, TravelForm, EmailForm,\
@ -27,7 +29,7 @@ def auth_deny(choice,pk,auth):
return HttpResponse(f'ERROR! UNKNWON CHOICE TYPE! {choice}') return HttpResponse(f'ERROR! UNKNWON CHOICE TYPE! {choice}')
return False return False
@login_required
def authorize(request, choice, pk): def authorize(request, choice, pk):
'''If IF grant a support they click a link in a mail which leads here. '''If IF grant a support they click a link in a mail which leads here.
We write the granted field in the database here and set a timestamp.''' We write the granted field in the database here and set a timestamp.'''
@ -38,7 +40,7 @@ def authorize(request, choice, pk):
else: else:
return HttpResponse(f"AUTHORIZED! choice: {choice}, pk: {pk}") return HttpResponse(f"AUTHORIZED! choice: {choice}, pk: {pk}")
@login_required
def deny(request, choice, pk): def deny(request, choice, pk):
'''If IF denies a support they click a link in a mail which leads here '''If IF denies a support they click a link in a mail which leads here
We write the granted field in the database here.''' We write the granted field in the database here.'''
@ -53,7 +55,8 @@ def deny(request, choice, pk):
def done(request): def done(request):
return HttpResponse("Your data is save now.") return HttpResponse("Your data is save now.")
class InternView(CookieWizardView):
class InternView(LoginRequiredMixin, CookieWizardView):
'''This View is for WMDE-employees only''' '''This View is for WMDE-employees only'''
template_name = 'input/extern.html' template_name = 'input/extern.html'