forked from Silverfish/proton-bridge
chore(GODT-2799): Separate account states for SMTP Backend
Rather than accessing the Bridge user list, each user register their individual SMTP service with the server manager. Note that some dependencies on the user data are hidden behind the `UserInterface`. These will be removed in a future patch.
This commit is contained in:
@ -545,6 +545,10 @@ func (bridge *Bridge) addUserWithVault(
|
||||
return fmt.Errorf("failed to add IMAP user: %w", err)
|
||||
}
|
||||
|
||||
if err := bridge.addSMTPUser(ctx, user); err != nil {
|
||||
return fmt.Errorf("failed to add SMTP user: %w", err)
|
||||
}
|
||||
|
||||
// Handle events coming from the user before forwarding them to the bridge.
|
||||
// For example, if the user's addresses change, we need to update them in gluon.
|
||||
bridge.tasks.Once(func(ctx context.Context) {
|
||||
@ -613,6 +617,10 @@ func (bridge *Bridge) logoutUser(ctx context.Context, user *user.User, withAPI,
|
||||
logrus.WithError(err).Error("Failed to remove IMAP user")
|
||||
}
|
||||
|
||||
if err := bridge.removeSMTPUser(ctx, user); err != nil {
|
||||
logrus.WithError(err).Error("Failed to remove SMTP user")
|
||||
}
|
||||
|
||||
if err := user.Logout(ctx, withAPI); err != nil {
|
||||
logrus.WithError(err).Error("Failed to logout user")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user