diff --git a/app/views.py b/app/views.py index 50882fc..c44cae6 100644 --- a/app/views.py +++ b/app/views.py @@ -39,6 +39,7 @@ def login(request, *args, **kwargs): 'success': False } else: + request.session['is_logged'] = True while True: try: request.session[request.session.session_key] = Fernet.generate_key().decode('utf-8') @@ -46,12 +47,16 @@ def login(request, *args, **kwargs): break except KeyError: continue - + + while True: + if request.session.has_key(request.session.session_key): + break + + print(request.session.session_key) sender_return['s'] = json.dumps(sender_return['s']) sender_return['s'] = sender_return['s'].encode() sender_return['s'] = rkey.encrypt(sender_return['s']) sender_return['s'] = sender_return['s'].decode('utf-8') - request.session['is_logged'] = True data_response = {'success': True, 'data': sender_return} return JsonResponse(data_response) diff --git a/frontend/views.py b/frontend/views.py index d0f4550..e4bef84 100644 --- a/frontend/views.py +++ b/frontend/views.py @@ -2,6 +2,7 @@ from django.shortcuts import render from django.shortcuts import redirect def default_view(request, *args, **kwargs): + request.session['has_session'] = True return render(request, 'frontend/index.html') def content_view(request, *args, **kwargs):