mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-05 14:09:29 +02:00
Resolve "Use cookies instead of local storage for auth in Web UI"
This commit is contained in:
parent
c0055b3b20
commit
c395076fce
18 changed files with 203 additions and 153 deletions
16
api/funkwhale_api/users/auth_serializers.py
Normal file
16
api/funkwhale_api/users/auth_serializers.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
from django.contrib import auth
|
||||
|
||||
from rest_framework import serializers
|
||||
|
||||
|
||||
class LoginSerializer(serializers.Serializer):
|
||||
username = serializers.CharField()
|
||||
password = serializers.CharField()
|
||||
|
||||
def validate(self, validated_data):
|
||||
user = auth.authenticate(request=None, **validated_data)
|
||||
if user is None:
|
||||
raise serializers.ValidationError("Invalid username or password")
|
||||
|
||||
validated_data["user"] = user
|
||||
return validated_data
|
Loading…
Add table
Add a link
Reference in a new issue