In the Indonesian market town of Cianjur, new rules require government workers to clock in with their thumb prints at a downtown mosque to confirm attendance at morning prayers. That’s on the order of district chief Irvan Rivano Muchtar, who also wants a 10 p.m. curfew for the town and is sending police to stop teenage girls and boys hanging out without parental supervision.

The 36-year-old elected official, who belongs to a mainstream, secular political party, likes traveling and listening to bands such as Coldplay. These...