CFPB survives legal attack as court trims director's power