Refactor password reset: pass idg function. Trim password before check.