Merge pull request #7743 from Ultimaker/CURA-7427_Add_option_to_sign_in_with_different_account_while_waiting_for_printers

Cura 7427 add option to sign in with different account while waiting for printers
This commit is contained in:
Nino van Hooff 2020-05-12 17:39:07 +02:00 committed by GitHub
commit f34e05ac03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 105 additions and 18 deletions

View file

@ -163,11 +163,23 @@ class Account(QObject):
self._update_timer.stop()
@pyqtSlot()
def login(self) -> None:
@pyqtSlot(bool)
def login(self, force_logout_before_login: bool = False) -> None:
"""
Initializes the login process. If the user is logged in already and force_logout_before_login is true, Cura will
logout from the account before initiating the authorization flow. If the user is logged in and
force_logout_before_login is false, the function will return, as there is nothing to do.
:param force_logout_before_login: Optional boolean parameter
:return: None
"""
if self._logged_in:
# Nothing to do, user already logged in.
return
self._authorization_service.startAuthorizationFlow()
if force_logout_before_login:
self.logout()
else:
# Nothing to do, user already logged in.
return
self._authorization_service.startAuthorizationFlow(force_logout_before_login)
@pyqtProperty(str, notify=loginStateChanged)
def userName(self):