agree create 3
This commit is contained in:
parent
de61de4be3
commit
909d232480
@ -41,23 +41,21 @@ def gdpr_create_agree(request):
|
|||||||
data = form.cleaned_data['data']
|
data = form.cleaned_data['data']
|
||||||
sha256 = hashlib.sha256()
|
sha256 = hashlib.sha256()
|
||||||
sha256.update(data.encode('utf-8'))
|
sha256.update(data.encode('utf-8'))
|
||||||
assert request.user.username[64:] == sha256.hexdigest(), "Persoonsgegevens have been tinkered with"
|
assert request.session.get('samlPersoonsgegevensHash', None) == sha256.hexdigest(), "Persoonsgegevens have been tinkered with"
|
||||||
|
request.user = User()
|
||||||
request.user.username, request.user.first_name, request.user.last_name, request.user.email = json.loads(data)
|
request.user.username, request.user.first_name, request.user.last_name, request.user.email = json.loads(data)
|
||||||
|
request.user.is_active = True
|
||||||
|
request.user.save()
|
||||||
|
|
||||||
return render(request, 'rugwebsite/gdpr_agree_success.html', {'shownav': True})
|
return render(request, 'rugwebsite/gdpr_agree_success.html', {'shownav': True})
|
||||||
else:
|
else:
|
||||||
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'))
|
request.session['samlPersoonsgegevensHash'] = sha256.hexdigest()
|
||||||
request.user.username = get_random_string(length=64) + sha256.hexdigest()
|
request.user.delete()
|
||||||
request.user.first_name = ''
|
|
||||||
request.user.last_name = ''
|
|
||||||
request.user.email = ''
|
|
||||||
request.user.save()
|
|
||||||
|
|
||||||
form = GDPRAgreeCreate()
|
form = GDPRAgreeCreate(defaults={'data': data})
|
||||||
return render(request, 'rugwebsite/gdpr.html', {'created': True, 'shownav': True, 'data': json.dumps(data),
|
return render(request, 'rugwebsite/gdpr.html', {'created': True, 'shownav': True, 'form': form})
|
||||||
'form': form})
|
|
||||||
|
|
||||||
|
|
||||||
def gdpr_request_delete(request):
|
def gdpr_request_delete(request):
|
||||||
|
Loading…
Reference in New Issue
Block a user