SACRAMENTO — Governor Jerry Brown took to Twitter on Thursday to announce that he had signed legislation barring employers and colleges from demanding the social media passwords of their workers and students.

“California pioneered the social media revolution,” Brown tweeted. “These laws protect Californians from unwarranted invasions of their social media accounts.”