Password example fixes/cleanup

Only one of these commits is necessary to get the example working, so I can re-submit the PR with just that commit if you'd like.

The other two commits are just to clean up the example's usability / event listening.