fix login/logout flow when jumping domains

This commit is contained in:
Stephen Birarda 2014-02-25 16:10:08 -08:00
parent 6d847f29fb
commit 2496c6252f
3 changed files with 7 additions and 1 deletions

View file

@ -94,7 +94,7 @@ Menu::Menu() :
toggleLoginMenuItem();
// connect to the appropriate slots of the AccountManager so that we can change the Login/Logout menu item
connect(&accountManager, &AccountManager::loginComplete, this, &Menu::toggleLoginMenuItem);
connect(&accountManager, &AccountManager::foundOrRequestedAccessToken, this, &Menu::toggleLoginMenuItem);
connect(&accountManager, &AccountManager::logoutComplete, this, &Menu::toggleLoginMenuItem);
addDisabledActionAndSeparator(fileMenu, "Scripts");

View file

@ -88,6 +88,8 @@ void AccountManager::setAuthURL(const QUrl& authURL) {
// pull out the stored access token and store it in memory
_accountInfo = settings.value(key).value<DataServerAccountInfo>();
qDebug() << "Found a data-server access token for" << qPrintable(keyURL.toString());
emit foundOrRequestedAccessToken();
}
}
@ -272,6 +274,9 @@ void AccountManager::requestFinished() {
// the username has changed to whatever came back
emit usernameChanged(_accountInfo.getUsername());
// we have found or requested an access token
emit foundOrRequestedAccessToken();
// store this access token into the local settings
QSettings localSettings;
localSettings.beginGroup(ACCOUNTS_GROUP);

View file

@ -61,6 +61,7 @@ signals:
void authRequired();
void authEndpointChanged();
void usernameChanged(const QString& username);
void foundOrRequestedAccessToken();
void loginComplete(const QUrl& authURL);
void logoutComplete();
private slots: