Allow password change when logged in.
Add tests for password changes and fix some bugs.