diff --git a/app/views.py b/app/views.py index 0cc59dd..ee14306 100644 --- a/app/views.py +++ b/app/views.py @@ -40,13 +40,8 @@ def login(request, *args, **kwargs): } else: request.session['is_logged'] = True - while True: - try: - request.session[request.session.session_key] = Fernet.generate_key().decode('utf-8') - rkey = Fernet(bytes(request.session[request.session.session_key], 'utf-8')) - break - except KeyError: - continue + request.session[request.session.session_key] = Fernet.generate_key().decode('utf-8') + rkey = Fernet(bytes(request.session[request.session.session_key], 'utf-8')) sender_return['s'] = json.dumps(sender_return['s']) sender_return['s'] = sender_return['s'].encode() diff --git a/frontend/static/frontend/js/login.js b/frontend/static/frontend/js/login.js index b84bdbc..cb37027 100644 --- a/frontend/static/frontend/js/login.js +++ b/frontend/static/frontend/js/login.js @@ -5,6 +5,7 @@ const login = () => { const Password = document.querySelector('#id_Password').value; const symbol = document.querySelector('#id_Symbol').value; const diary = document.querySelector('#id_diary').value; + button.removeEventListener('click', login) if(loginName != '' && Password != '' && symbol != ''){ switch(diary){ case 'Fakelog': @@ -43,6 +44,7 @@ const login = () => { else{ document.querySelector('#error').innerHTML = 'Nieprawidłowy login, hasło lub symbol'; } + button.addEventListener('click', login); }); } };