agree create 3
This commit is contained in:
parent
004c3a534f
commit
fe93d23747
@ -3,7 +3,7 @@ import hashlib
|
|||||||
|
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.contrib.auth.models import User
|
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.forms import RequestGDPRDelete, GDPRAgreeCreate
|
||||||
from rugwebsite.models import PendingGDPRAgree, GDPRAgreed, PendingGDPRDelete
|
from rugwebsite.models import PendingGDPRAgree, GDPRAgreed, PendingGDPRDelete
|
||||||
@ -48,15 +48,16 @@ def gdpr_create_agree(request):
|
|||||||
|
|
||||||
return render(request, 'rugwebsite/gdpr_agree_success.html', {'shownav': True})
|
return render(request, 'rugwebsite/gdpr_agree_success.html', {'shownav': True})
|
||||||
else:
|
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])
|
data = json.dumps([request.user.username, request.user.first_name, request.user.last_name, request.user.email])
|
||||||
sha256 = hashlib.sha256()
|
sha256 = hashlib.sha256()
|
||||||
sha256.update(data.encode('utf-8'))
|
sha256.update(data.encode('utf-8'))
|
||||||
request.user.delete()
|
request.user.delete()
|
||||||
request.session['samlPersoonsgegevensHash'] = sha256.hexdigest()
|
request.session['samlPersoonsgegevensHash'] = sha256.hexdigest()
|
||||||
|
|
||||||
form = GDPRAgreeCreate(initial={'data': data})
|
form = GDPRAgreeCreate(initial={'data': data})
|
||||||
return render(request, 'rugwebsite/gdpr.html', {'created': True, 'shownav': True, 'form': form})
|
return render(request, 'rugwebsite/gdpr.html', {'created': True, 'shownav': True, 'form': form})
|
||||||
|
return redirect('/')
|
||||||
|
|
||||||
|
|
||||||
def gdpr_request_delete(request):
|
def gdpr_request_delete(request):
|
||||||
|
Loading…
Reference in New Issue
Block a user