It may well have been inappropriate and/or unprofessional - no one said otherwise.

But it was not illegal.