Honestly I have no sympathy for bratty kids who dink around on their phones during class, but this is unacceptable from a teacher.

Confiscate the phone, absolutely. But going into it and tinkering with things like the password? Flat out unacceptable.