Generate login based on user's email.

If not possible, fallback to generating a random string.
Previous solution of resetting 'login' to same as 'uid'
doesn't work because while 'uid' is case-sensitive,
'login' is not.  Therefore, there will be collisions
in the 'login' space.
Allow pre-M10 accounts to reset password.

At the same time, migrate user account to M10/Orion 2.0
version.
Set generated login, don't use UID.
Confirm emails when fixing up pre-M10 users.

This patch makes it work for the /login case as well.