mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-09 15:57:52 -06:00
Moved loading of the authentication to the account
CURA-5744
This commit is contained in:
parent
cf6d3b9289
commit
506ec5109d
2 changed files with 2 additions and 3 deletions
|
@ -44,7 +44,7 @@ class Account(QObject):
|
||||||
)
|
)
|
||||||
|
|
||||||
self._authorization_service = AuthorizationService(Application.getInstance().getPreferences(), self._oauth_settings)
|
self._authorization_service = AuthorizationService(Application.getInstance().getPreferences(), self._oauth_settings)
|
||||||
|
self._authorization_service.loadAuthDataFromPreferences()
|
||||||
self._authorization_service.onAuthStateChanged.connect(self._onLoginStateChanged)
|
self._authorization_service.onAuthStateChanged.connect(self._onLoginStateChanged)
|
||||||
self._authorization_service.onAuthenticationError.connect(self._onLoginStateChanged)
|
self._authorization_service.onAuthenticationError.connect(self._onLoginStateChanged)
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ class AuthorizationService:
|
||||||
self._user_profile = None # type: Optional["UserProfile"]
|
self._user_profile = None # type: Optional["UserProfile"]
|
||||||
self._cura_preferences = preferences
|
self._cura_preferences = preferences
|
||||||
self._server = LocalAuthorizationServer(self._auth_helpers, self._onAuthStateChanged, daemon=True)
|
self._server = LocalAuthorizationServer(self._auth_helpers, self._onAuthStateChanged, daemon=True)
|
||||||
self._loadAuthData()
|
|
||||||
|
|
||||||
# Get the user profile as obtained from the JWT (JSON Web Token).
|
# Get the user profile as obtained from the JWT (JSON Web Token).
|
||||||
# If the JWT is not yet parsed, calling this will take care of that.
|
# If the JWT is not yet parsed, calling this will take care of that.
|
||||||
|
@ -135,7 +134,7 @@ class AuthorizationService:
|
||||||
self._server.stop() # Stop the web server at all times.
|
self._server.stop() # Stop the web server at all times.
|
||||||
|
|
||||||
# Load authentication data from preferences.
|
# Load authentication data from preferences.
|
||||||
def _loadAuthData(self) -> None:
|
def loadAuthDataFromPreferences(self) -> None:
|
||||||
self._cura_preferences.addPreference(self._settings.AUTH_DATA_PREFERENCE_KEY, "{}")
|
self._cura_preferences.addPreference(self._settings.AUTH_DATA_PREFERENCE_KEY, "{}")
|
||||||
try:
|
try:
|
||||||
preferences_data = json.loads(self._cura_preferences.getValue(self._settings.AUTH_DATA_PREFERENCE_KEY))
|
preferences_data = json.loads(self._cura_preferences.getValue(self._settings.AUTH_DATA_PREFERENCE_KEY))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue