Connect signals before loading auth data

CURA-5744
This commit is contained in:
Jaime van Kessel 2018-09-27 13:45:46 +02:00
parent 47c5dbaf84
commit f8369703ed

View file

@ -42,15 +42,14 @@ class Account(QObject):
AUTH_SUCCESS_REDIRECT="{}/app/auth-success".format(self._oauth_root),
AUTH_FAILED_REDIRECT="{}/app/auth-error".format(self._oauth_root)
)
self._authorization_service = AuthorizationService(Application.getInstance().getPreferences(), self._oauth_settings)
self._authorization_service.loadAuthDataFromPreferences()
self._authorization_service.onAuthStateChanged.connect(self._onLoginStateChanged)
self._authorization_service.onAuthenticationError.connect(self._onLoginStateChanged)
self._error_message = None # type: Optional[Message]
self._logged_in = False
self._authorization_service = AuthorizationService(Application.getInstance().getPreferences(), self._oauth_settings)
self._authorization_service.onAuthStateChanged.connect(self._onLoginStateChanged)
self._authorization_service.onAuthenticationError.connect(self._onLoginStateChanged)
self._authorization_service.loadAuthDataFromPreferences()
@pyqtProperty(bool, notify=loginStateChanged)
def isLoggedIn(self) -> bool:
return self._logged_in