feat: remove user from bridge users list if init failed

This commit is contained in:
James Houlahan 2020-04-16 15:21:31 +02:00
parent 3f32fd95e0
commit bfc4069df4
1 changed files with 1 additions and 1 deletions

View File

@ -332,10 +332,10 @@ func (b *Bridge) addNewUser(user *pmapi.User, auth *pmapi.Auth, hashedPassword s
}
// The user needs to be part of the users list in order for it to receive an auth during initialisation.
// TODO: If adding the user fails, we don't want to leave it there.
b.users = append(b.users, bridgeUser)
if err = bridgeUser.init(b.idleUpdates); err != nil {
b.users = b.users[:len(b.users)-1]
return errors.Wrap(err, "failed to initialise user")
}