The Massachusetts Senate voted to pass a bill that makes it illegal, in most circumstances, for employers and school administrators to demand access to employees’, applicants’, and students’ social media accounts.

The bill would make it illegal for a boss or prospective boss to demand a user name or password for any personal social media account. It would also make it illegal for a boss to require an employer to connect on any social media platform as a condition of employment. The same goes at the schools, across all levels of education.

The bill does not stand in the way of employers looking at, and making judgments based on, what employees have publicly shared on social media. But it does prevent them from accessing the back end of a user’s account, which might include things like private message

In its latest form, the bill includes language that would allow for employers and schools to ask for the information if it is “reasonably believed to be relevant” to an investigation of a violation law or employee misconduct. In students’ case, that provision only applies to potential violations of law, said Boston.com.

Prior to being taken up for a vote on its own, the bill had been wrapped into the Senate’s proposed budget for this fiscal year. Officials involved with the bill expressed optimism at the time that it would be taken up by lawmakers before the end of the legislative session later this month, said Boston.com.

 The bill will now head to the House.