Add "Sign in with another account" button in AddCloudPrintersView

There are cases where Cura and the browser fall out of sync when it
comes to accounts. In such cases, you may be logged in cura with an
account that has no cloud printers and in the browser with an account
that has printers. So when you press the "Add cloud printer" button,
you are redirected to mycloud and you see cloud printers that are not
detected by Cura (because Cura is in a different acconut). In such
cases, the user can now press the "Sign in with a different account"
link in the "Waiting for cloud response" page, which will log him/her
out in Cura AND in the browser, and then reinitiate the whole
authorization flow, to make sure the accounts are in sync.

CURA-7427
This commit is contained in:
Kostas Karmas 2020-05-11 17:47:09 +02:00
parent 5ccf8e412d
commit b717755f20
3 changed files with 58 additions and 6 deletions

View file

@ -96,6 +96,18 @@ class Account(QObject):
return
self._authorization_service.startAuthorizationFlow()
@pyqtSlot()
def loginWithForcedLogout(self) -> None:
"""
Forces a logout from Cura and then initiates the authorization flow with the force_logout_from_mycloud variable
as true, to sync the accounts in Cura and in the browser.
:return: None
"""
if self._logged_in:
self.logout()
self._authorization_service.startAuthorizationFlow(True)
@pyqtProperty(str, notify=loginStateChanged)
def userName(self):
user_profile = self._authorization_service.getUserProfile()