agree create 3

This commit is contained in:
H.T. Kruitbosch 2018-05-04 17:05:18 +02:00
parent 004c3a534f
commit fe93d23747

View File

@ -3,7 +3,7 @@ import hashlib
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.shortcuts import render
from django.shortcuts import render, redirect
from rugwebsite.forms import RequestGDPRDelete, GDPRAgreeCreate
from rugwebsite.models import PendingGDPRAgree, GDPRAgreed, PendingGDPRDelete
@ -48,7 +48,7 @@ def gdpr_create_agree(request):
return render(request, 'rugwebsite/gdpr_agree_success.html', {'shownav': True})
else:
assert request.user.is_authenticated(), "User should be authenticated."
if request.user.is_authenticated():
data = json.dumps([request.user.username, request.user.first_name, request.user.last_name, request.user.email])
sha256 = hashlib.sha256()
sha256.update(data.encode('utf-8'))
@ -57,6 +57,7 @@ def gdpr_create_agree(request):
form = GDPRAgreeCreate(initial={'data': data})
return render(request, 'rugwebsite/gdpr.html', {'created': True, 'shownav': True, 'form': form})
return redirect('/')
def gdpr_request_delete(request):