mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-27 04:41:06 -07:00
Don't crash if keyring access is denied on MacOS
CURA-8332
This commit is contained in:
parent
cfe395460f
commit
c1618565ea
1 changed files with 9 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ from typing import Type, TYPE_CHECKING, Optional, List
|
||||||
|
|
||||||
import keyring
|
import keyring
|
||||||
from keyring.backend import KeyringBackend
|
from keyring.backend import KeyringBackend
|
||||||
|
from keyring.backends.macOS.api import KeychainDenied
|
||||||
from keyring.errors import NoKeyringError, PasswordSetError
|
from keyring.errors import NoKeyringError, PasswordSetError
|
||||||
|
|
||||||
from UM.Logger import Logger
|
from UM.Logger import Logger
|
||||||
|
|
@ -39,6 +40,14 @@ class KeyringAttribute:
|
||||||
self._store_secure = False
|
self._store_secure = False
|
||||||
Logger.logException("w", "No keyring backend present")
|
Logger.logException("w", "No keyring backend present")
|
||||||
return getattr(instance, self._name)
|
return getattr(instance, self._name)
|
||||||
|
except KeychainDenied:
|
||||||
|
self._store_secure = False
|
||||||
|
Logger.logException("w", "Access to the keyring was denied.")
|
||||||
|
return getattr(instance, self._name)
|
||||||
|
except Exception as e:
|
||||||
|
self._store_secure = False
|
||||||
|
Logger.logException("w", f"Something went wrong while trying to retrieve the password from the Keyring. Exception: {e}")
|
||||||
|
return getattr(instance, self._name)
|
||||||
else:
|
else:
|
||||||
return getattr(instance, self._name)
|
return getattr(instance, self._name)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue