Other: added user's primary email address to the vault.

This commit is contained in:
Xavier Michelon
2023-01-17 10:16:12 +01:00
parent 03c8c323bc
commit a377384553
8 changed files with 70 additions and 20 deletions

View File

@ -147,7 +147,12 @@ func migrateOldAccount(userID string, store *credentials.Store, v *vault.Vault)
return fmt.Errorf("failed to split api token for user %q: %w", userID, err)
}
user, err := v.AddUser(creds.UserID, creds.Name, authUID, authRef, creds.MailboxPassword)
var primaryEmail string
if len(creds.EmailList()) > 0 {
primaryEmail = creds.EmailList()[0]
}
user, err := v.AddUser(creds.UserID, creds.Name, primaryEmail, authUID, authRef, creds.MailboxPassword)
if err != nil {
return fmt.Errorf("failed to add user %q: %w", userID, err)
}