Fix the behaviour of the trusted connection checkbox (#6262)