Fix
This commit is contained in:
parent
5fdb7fdedc
commit
73684c1af4
1 changed files with 9 additions and 3 deletions
12
app/views.py
12
app/views.py
|
@ -39,11 +39,17 @@ def login(request, *args, **kwargs):
|
|||
'success': False
|
||||
}
|
||||
else:
|
||||
request.session[request.session.session_key] = Fernet.generate_key().decode('utf-8')
|
||||
key = bytes(request.session[request.session.session_key], 'utf-8')
|
||||
rkey = Fernet(key)
|
||||
while True:
|
||||
try:
|
||||
rkey = Fernet(bytes(request.session[request.session.session_key], 'utf-8'))
|
||||
break
|
||||
except KeyError:
|
||||
continue
|
||||
|
||||
|
||||
sender_return['s'] = json.dumps(sender_return['s'])
|
||||
sender_return['s'] = sender_return['s'].encode()
|
||||
print(bytes(request.session[request.session.session_key], 'utf-8'))
|
||||
sender_return['s'] = rkey.encrypt(sender_return['s'])
|
||||
sender_return['s'] = sender_return['s'].decode('utf-8')
|
||||
request.session['is_logged'] = True
|
||||
|
|
Loading…
Reference in a new issue