Fix KeyError: userid error
This commit is contained in:
parent
a1695fbdd9
commit
1ed58d3174
1 changed files with 9 additions and 1 deletions
10
app/views.py
10
app/views.py
|
@ -41,8 +41,16 @@ def login(request, *args, **kwargs):
|
|||
else:
|
||||
key = Fernet.generate_key()
|
||||
rkey = Fernet(key)
|
||||
|
||||
x = None
|
||||
request.session[request.session.session_key] = key.decode('utf-8')
|
||||
|
||||
while x == None:
|
||||
try:
|
||||
x = request.session[request.session.session_key]
|
||||
x = x
|
||||
except KeyError:
|
||||
x = None
|
||||
|
||||
sender_return['s'] = json.dumps(sender_return['s'])
|
||||
sender_return['s'] = sender_return['s'].encode()
|
||||
sender_return['s'] = rkey.encrypt(sender_return['s'])
|
||||
|
|
Loading…
Reference in a new issue