This may be prudent company policy, but it is not the law.
I didn’t say anything about it being illegal. That’s just the standard sexual harassment policies that most corporations have.