Changing the unique key to identify users

Yes. More specifically, when the user logs in, this is what happens:

  1. Is a user with this external id already known? If so, log in. Otherwise, continue.
  2. If a user with this email already known? If so, associate the external id with the account, and log in. Otherwise, continue.
  3. Create an account with the specified email and store the external id. Then, log in.