Refactor basic password checks. Closes #3552.