Lots of refactoring and bugfixes.

There were numerous bugs with spaces not being properly removed from
passwords, and changes to all fields not properly affecting the
possibility to click on the Change button.