Merge pull request #33 from wulkanowy/bugfix/InvalidToken

Fix InvalidToken error
This commit is contained in:
Zaptyp 2021-01-30 12:00:42 +01:00 committed by GitHub
commit 62cc1bcf87
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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);
});
}
};