We've encountered an issue related to two-factor authentication cookie validation after a major Django version upgrade, as detailed in issue [#686](https://github.com/jazzband/django-two-factor-auth/issues/686). This issue arises due to the change in user password hashes when Django's hash iteration count is updated in a new version, leading to a mismatch in the two-factor authentication cookies' validation.

We can for now implement a workaround. This involves catching the `BadSignature` exception raised during the cookie validation process when there's a mismatch in the hashes. This situation occurs after upgrading Django, which causes the user's password hash to change, thereby invalidating the existing two-factor authentication cookies.

This issue is critical for us to upgrade our Django version without disrupting the user experience of people coming back and having a 2FA cookie.

posthog/api/authentication.py
queryset = User.objects.none()
    serializer_class = LoginPrecheckSerializer
    permission_classes = (permissions.AllowAny,)
class PasswordResetSerializer(serializers.Serializer):
    email = serializers.EmailField(write_only=True)
    def create(self, validated_data):
        email = validated_data.pop("email")
        
        if OrganizationDomain.objects.get_sso_enforcement_for_email_address(email):
            raise serializers.ValidationError(
                "Password reset is disabled because SSO login is enforced for this domain.",
                code="sso_enforced",
            )
        if not is_email_available():
            raise serializers.ValidationError(
                "Cannot reset passwords because email is not configured for your instance. Please contact your administrator.",
                code="email_not_available",
            )
        try:
            user = User.objects.filter(is_active=True).get(email=email)
        except User.DoesNotExist:
            user = None
        if user:
            user.requested_password_reset_at = datetime.datetime.now()
            user.save()
            token = password_reset_token_generator.make_token(user)
            send_password_reset(user.id, token)
        return True
class PasswordResetCompleteSerializer(serializers.Serializer):