agree create 3

This commit is contained in:
H.T. Kruitbosch 2018-05-04 17:16:56 +02:00
parent 42444c12dc
commit 637f4d2a55

View File

@ -48,7 +48,7 @@ def gdpr_create_agree(request):
user.username, user.first_name, user.last_name, user.email = json.loads(data)
user.is_active = True
user.save()
login(request, user, backend=import_string('django_saml2_pro_auth.auth.Backend'))
login(request, user, backend=request.session.get('samlBackend', 'django_saml2_pro_auth.auth.Backend'))
return render(request, 'rugwebsite/gdpr_agree_success.html', {'shownav': True})
else:
@ -56,9 +56,11 @@ def gdpr_create_agree(request):
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'))
request.session['samlBackend'] = request.user.backend
request.user.delete()
request.session['samlPersoonsgegevensHash'] = sha256.hexdigest()
form = GDPRAgreeCreate(initial={'data': data})
return render(request, 'rugwebsite/gdpr.html', {'created': True, 'shownav': True, 'form': form})
return redirect('/')