check that the email address the user is changing to isn't already used

in process fix email_exists to be able to return the id of the user with
the checked email
space/tab consistency fixes
send email confirmation when user changes email address
optionally do not send confirmation email in user->update_self

To prevent sending mail during tests
optionally do not redirect after confirming user email

For use in tests