Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- urlpatterns = [
- url(r'^auth/verify/(?P<verification_hash>[0-9A-z-]+)/$', VerifyUserView.as_view(), name='verify_user'),
- ]
- class VerifyUserView(generics.UpdateAPIView):
- from .serializers import VerificationHashSerializer
- serializer_class = VerificationHashSerializer
- lookup_field = "verification_hash"
- def get_queryset(self):
- from iceberg.models import VerificationHash
- verification_hash = self.kwargs.get('verification_hash')
- token = VerificationHash.objects.get(verification_hash=verification_hash)
- return token
- def perform_update(self, serializer: VerificationHashSerializer):
- from iceberg.models import VerificationHash
- verification_hash = self.kwargs.get('verification_hash')
- token = VerificationHash.objects.get(verification_hash=verification_hash)
- token.active = False
- token.save()
- token.user.active = True
- token.user.save()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement