mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2025-04-21 17:22:06 +03:00
Make VerifyEmailView viewable in rest framework API browser
This commit is contained in:
parent
3b80fcbca9
commit
82e2d710da
|
@ -1,7 +1,7 @@
|
|||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.conf import settings
|
||||
|
||||
from rest_framework.views import APIView
|
||||
from rest_framework.generics import GenericAPIView
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.permissions import AllowAny
|
||||
from rest_framework.generics import CreateAPIView
|
||||
|
@ -65,16 +65,16 @@ class RegisterView(CreateAPIView):
|
|||
return user
|
||||
|
||||
|
||||
class VerifyEmailView(APIView, ConfirmEmailView):
|
||||
|
||||
class VerifyEmailView(GenericAPIView):
|
||||
serializer_class = VerifyEmailSerializer
|
||||
permission_classes = (AllowAny,)
|
||||
allowed_methods = ('POST', 'OPTIONS', 'HEAD')
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
serializer = VerifyEmailSerializer(data=request.data)
|
||||
serializer = self.get_serializer(data=request.data)
|
||||
serializer.is_valid(raise_exception=True)
|
||||
self.kwargs['key'] = serializer.validated_data['key']
|
||||
confirmation = self.get_object()
|
||||
view = ConfirmEmailView()
|
||||
view.kwargs = {'key': serializer.validated_data['key']}
|
||||
confirmation = view.get_object()
|
||||
confirmation.confirm(self.request)
|
||||
return Response({'message': _('ok')}, status=status.HTTP_200_OK)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user