Synchronise the email address associated with a Manuscripts account based on `email` and `emails` fields in the Connect ID token
Connect identity tokens will soon begin to include an emails
field that lists all email addresses connected to the user. This allows us to synchronise the Manuscripts side records of user email addresses, such that if a login email address has been removed, the Manuscripts side record should also remove the email address to user association.
The extent to which we should synchronise this information for the time being is the following:
If the email
property used at login time does not match the one held against the Connect ID in the Manuscripts database, and the emails
property does not include the address used, the Manuscripts user record should be updated with the email actually included in the ID token.