cleanup: Remove notification of keychain error

Issue #13
create-reload-action
Lukasz Janyst 4 years ago
parent 9aedcfb8fe
commit 62aee11cb9
No known key found for this signature in database
GPG Key ID: 32DE641041F17A9A
  1. 6
      pkg/users/user.go
  2. 9
      pkg/users/users.go

@ -67,7 +67,6 @@ func newUser(
creds, err := credStorer.Get(userID)
if err != nil {
notifyKeychainRepair(eventListener, err)
return nil, nil, errors.Wrap(err, "failed to load user credentials")
}
@ -160,7 +159,6 @@ func (u *User) handleAuthRefresh(auth *pmapi.AuthRefresh) {
creds, err := u.credStorer.UpdateToken(u.userID, auth.UID, auth.RefreshToken)
if err != nil {
notifyKeychainRepair(u.listener, err)
u.log.WithError(err).Error("Failed to update refresh token in credentials store")
return
}
@ -407,7 +405,6 @@ func (u *User) UpdateUser(ctx context.Context) error {
creds, err := u.credStorer.UpdateEmails(u.userID, u.client.Addresses().ActiveEmails())
if err != nil {
notifyKeychainRepair(u.listener, err)
return err
}
@ -445,7 +442,6 @@ func (u *User) SwitchAddressMode() error {
creds, err := u.credStorer.SwitchAddressMode(u.userID)
if err != nil {
notifyKeychainRepair(u.listener, err)
return errors.Wrap(err, "could not switch credentials store address mode")
}
@ -491,11 +487,9 @@ func (u *User) Logout() error {
creds, err := u.credStorer.Logout(u.userID)
if err != nil {
notifyKeychainRepair(u.listener, err)
u.log.WithError(err).Warn("Could not log user out from credentials store")
if err := u.credStorer.Delete(u.userID); err != nil {
notifyKeychainRepair(u.listener, err)
u.log.WithError(err).Error("Could not delete user from credentials store")
}
} else {

@ -122,7 +122,6 @@ func (u *Users) loadUsersFromCredentialsStore() error {
userIDs, err := u.credStorer.List()
if err != nil {
notifyKeychainRepair(u.events, err)
return err
}
@ -181,7 +180,6 @@ func (u *Users) loadConnectedUser(ctx context.Context, user *User, creds *creden
// Update the user's credentials with the latest auth used to connect this user.
if creds, err = u.credStorer.UpdateToken(creds.UserID, auth.UID, auth.RefreshToken); err != nil {
notifyKeychainRepair(u.events, err)
return errors.Wrap(err, "could not create get user's refresh token")
}
@ -220,14 +218,12 @@ func (u *Users) FinishLogin(client pmapi.Client, auth *pmapi.Auth, password []by
// Update the user's credentials with the latest auth used to connect this user.
if _, err := u.credStorer.UpdateToken(auth.UserID, auth.UID, auth.RefreshToken); err != nil {
notifyKeychainRepair(u.events, err)
return nil, errors.Wrap(err, "failed to load user credentials")
}
// Update the password in case the user changed it.
creds, err := u.credStorer.UpdatePassword(apiUser.ID, passphrase)
if err != nil {
notifyKeychainRepair(u.events, err)
return nil, errors.Wrap(err, "failed to update password of user in credentials store")
}
@ -256,7 +252,6 @@ func (u *Users) addNewUser(client pmapi.Client, apiUser *pmapi.User, auth *pmapi
defer u.lock.Unlock()
if _, err := u.credStorer.Add(apiUser.ID, apiUser.Name, auth.UID, auth.RefreshToken, passphrase, client.Addresses().ActiveEmails()); err != nil {
notifyKeychainRepair(u.events, err)
return errors.Wrap(err, "failed to add user credentials to credentials store")
}
@ -373,7 +368,6 @@ func (u *Users) DeleteUser(userID string, clearStore bool) error {
}
if err := u.credStorer.Delete(userID); err != nil {
notifyKeychainRepair(u.events, err)
log.WithError(err).Error("Cannot remove user")
return err
}
@ -416,6 +410,3 @@ func (u *Users) crashBandicoot(username string) {
panic("Your wish is my command… I crash!")
}
}
func notifyKeychainRepair(l listener.Listener, err error) {
}

Loading…
Cancel
Save