Fix InvalidToken error

This commit is contained in:
Tomasz 2021-01-29 23:30:36 +01:00
parent b45cde1dbf
commit 03f7808b3d
2 changed files with 4 additions and 7 deletions

View file

@ -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()

View file

@ -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);
});
}
};