Commit 1a9d29a0 by Chif Gergő

Handle wrong auth token

parent 17f141d6
Pipeline #1094 passed with stage
in 1 minute 42 seconds
......@@ -17,8 +17,8 @@ class StatusConsumer(WebsocketConsumer):
# If login message arrives get the auth token from it
# Then subscribe to the channels of the vm's that belongs to the user
def login(self, auth_token):
token = Token.objects.get(key=auth_token)
if token:
try:
token = Token.objects.get(key=auth_token)
self.user = token.user
instances = Instance.objects.filter(created_by=self.user)
for inst in instances:
......@@ -26,7 +26,7 @@ class StatusConsumer(WebsocketConsumer):
str(inst.id),
self.channel_name
)
else:
except Token.DoesNotExist:
self.disconnect(100)
# Unsubscribe from registered groups
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment