diff --git a/client/views.py b/client/views.py index f4b83eb..edbc216 100644 --- a/client/views.py +++ b/client/views.py @@ -1,11 +1,15 @@ from rest_framework.response import Response from rest_framework.views import APIView - +from rest_framework.authentication import TokenAuthentication +from rest_framework.permissions import IsAuthenticated from .models import TaxType, Country, State, City, Client from .serializers import TaxTypeSerializer, CountrySerializer, StateSerializer, CitySerializer, ClientSerializer class TaxTypeList(APIView): + authentication_classes = [TokenAuthentication] + permission_classes = [IsAuthenticated] + def get(self, request): tax_types = TaxType.objects.all() serializer = TaxTypeSerializer(tax_types, many=True) @@ -13,6 +17,9 @@ class TaxTypeList(APIView): class CountryList(APIView): + authentication_classes = [TokenAuthentication] + permission_classes = [IsAuthenticated] + def get(self, request): countries = Country.objects.all() serializer = CountrySerializer(countries, many=True) @@ -20,6 +27,9 @@ class CountryList(APIView): class StateList(APIView): + authentication_classes = [TokenAuthentication] + permission_classes = [IsAuthenticated] + def get(self, request): states = State.objects.all() serializer = StateSerializer(states, many=True) @@ -27,6 +37,9 @@ class StateList(APIView): class CityList(APIView): + authentication_classes = [TokenAuthentication] + permission_classes = [IsAuthenticated] + def get(self, request): cities = City.objects.all() serializer = CitySerializer(cities, many=True) @@ -34,6 +47,9 @@ class CityList(APIView): class ClientList(APIView): + authentication_classes = [TokenAuthentication] + permission_classes = [IsAuthenticated] + def get(self, request): clients = Client.objects.all() serializer = ClientSerializer(clients, many=True) diff --git a/workx_backend/settings/base.py b/workx_backend/settings/base.py index 74f05a5..d956080 100644 --- a/workx_backend/settings/base.py +++ b/workx_backend/settings/base.py @@ -35,6 +35,7 @@ INSTALLED_APPS = [ PASSWORDLESS_AUTH = { 'PASSWORDLESS_AUTH_TYPES': ['EMAIL'], 'PASSWORDLESS_EMAIL_NOREPLY_ADDRESS': 'kj@webtrigon.com', + 'PASSWORDLESS_REGISTER_NEW_USERS': False, } MIDDLEWARE = [