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 = [
path('', include("input.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.template.loader import get_template
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,\
HonoraryCertificateForm, InternForm, TravelForm, EmailForm,\
@ -27,7 +29,7 @@ def auth_deny(choice,pk,auth):
return HttpResponse(f'ERROR! UNKNWON CHOICE TYPE! {choice}')
return False
@login_required
def authorize(request, choice, pk):
'''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.'''
@ -38,7 +40,7 @@ def authorize(request, choice, pk):
else:
return HttpResponse(f"AUTHORIZED! choice: {choice}, pk: {pk}")
@login_required
def deny(request, choice, pk):
'''If IF denies a support they click a link in a mail which leads here
We write the granted field in the database here.'''
@ -53,7 +55,8 @@ def deny(request, choice, pk):
def done(request):
return HttpResponse("Your data is save now.")
class InternView(CookieWizardView):
class InternView(LoginRequiredMixin, CookieWizardView):
'''This View is for WMDE-employees only'''
template_name = 'input/extern.html'