Refactor password change and reset