mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 01:39:18 +02:00
Revert "Merge branch '629-cookie-auth' into 'develop'"
This reverts commit8b47af8b81
, reversing changes made toc0055b3b20
.
This commit is contained in:
parent
666409dce0
commit
b9f0c6aecd
18 changed files with 153 additions and 203 deletions
|
@ -1,22 +1,17 @@
|
|||
from asgiref.sync import async_to_sync
|
||||
from channels.generic.websocket import JsonWebsocketConsumer
|
||||
from channels import auth
|
||||
|
||||
from funkwhale_api.common import channels
|
||||
|
||||
|
||||
class JsonAuthConsumer(JsonWebsocketConsumer):
|
||||
def connect(self):
|
||||
if "user" not in self.scope:
|
||||
try:
|
||||
self.scope["user"] = async_to_sync(auth.get_user)(self.scope)
|
||||
except (ValueError, AssertionError, AttributeError, KeyError):
|
||||
return self.close()
|
||||
|
||||
if self.scope["user"] and self.scope["user"].is_authenticated:
|
||||
return self.accept()
|
||||
else:
|
||||
try:
|
||||
assert self.scope["user"].pk is not None
|
||||
except (AssertionError, AttributeError, KeyError):
|
||||
return self.close()
|
||||
|
||||
return self.accept()
|
||||
|
||||
def accept(self):
|
||||
super().accept()
|
||||
for group in self.groups:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue