Do I need to do anything after a bathroom flooding? How can I prevent it in future?
A one-time hit of water won't do anything to structure, it'll dry out in a couple days and be fine. It's only when it gets a little bit wet every day, and never has a chance to dry that you'll get rot.  

Expect the staining in drywall to spread a little bit, and make sure it's completely dry before any repainting.

You can get water detection devices that sound an alarm when water is present, but they're more for basement flooding, they're certainly not attractive and not practical to leave in a common area like a bathroom, though they could be placed in the ceiling below. 

I would, after disconnecting power, look inside light fixture, and electrical boxes in the path, to check for any signs of remaining water.

Education to the unnamed individual is the best defense, for a one time occurrence it's nothing to worry about.