X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/8952b9530d943655e552ea660c47e850123c5105..131ae407ca583a8a8086cf94c222c85fa3f5be63:/src/api/serializers.py diff --git a/src/api/serializers.py b/src/api/serializers.py index eb6994c73..4ba660e26 100644 --- a/src/api/serializers.py +++ b/src/api/serializers.py @@ -1,5 +1,5 @@ -# 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 @@ -15,13 +15,30 @@ class PlainSerializer(serializers.ModelSerializer): 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'})