-# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
-# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
+# This file is part of Wolne Lektury, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
#
from django.contrib.auth.models import User
from rest_framework import serializers
class UserSerializer(serializers.ModelSerializer):
premium = UserPremiumField()
+ confirmed = serializers.BooleanField(source='is_active')
class Meta:
model = User
- fields = ['username', 'premium']
+ fields = ['username', 'premium', 'confirmed']
class BookUserDataSerializer(serializers.ModelSerializer):
class Meta:
model = BookUserData
fields = ['state']
+
+
+class LoginSerializer(serializers.Serializer):
+ username = serializers.CharField()
+ password = serializers.CharField(style={'input_type': 'password'})
+
+
+
+class RegisterSerializer(serializers.Serializer):
+ email = serializers.CharField()
+ password = serializers.CharField(style={'input_type': 'password'})
+ options = serializers.ListField(child=serializers.IntegerField())
+
+
+class RefreshTokenSerializer(serializers.Serializer):
+ refresh_token = serializers.CharField(style={'input_type': 'password'})