Fix domain login dialog disappearing when teleport to domain

This commit is contained in:
David Rowe 2020-07-25 21:46:18 +12:00
parent 361ab97d83
commit ed44438387
3 changed files with 7 additions and 10 deletions

View file

@ -117,8 +117,6 @@ void DialogsManager::toggleLoginDialog() {
void DialogsManager::showLoginDialog() {
qDebug() << "#######: showLoginDialog()";
// ####### TODO: May be called from script via DialogsManagerScriptingInterface. Need to handle the case that it's already
// displayed and may be the domain login version.
@ -132,9 +130,6 @@ void DialogsManager::hideLoginDialog() {
void DialogsManager::showDomainLoginDialog() {
qDebug() << "#######: showDomainLoginDialog()";
_isDomainLogin = true;
LoginDialog::showWithSelection();
}

View file

@ -133,14 +133,12 @@ void LoginDialog::dismissLoginDialog() {
}
void LoginDialog::login(const QString& username, const QString& password) const {
qDebug() << "Attempting to login " << username;
qDebug() << "Attempting to login" << username;
DependencyManager::get<AccountManager>()->requestAccessToken(username, password);
}
void LoginDialog::loginDomain(const QString& username, const QString& password, const QString& domainAuthProvider) const {
qDebug() << "####### LoginDialog::loginDomain()";
qDebug() << "Attempting to login " << username << "into a domain through" << domainAuthProvider;
qDebug() << "Attempting to login" << username << "into a domain through" << domainAuthProvider;
// ####### TODO
// DependencyManager::get<DomainAccountManager>()->requestAccessToken(username, password, domainAuthProvider);

View file

@ -11,6 +11,8 @@
#include "DomainAccountManager.h"
#include <QTimer>
DomainAccountManager::DomainAccountManager() {
@ -28,7 +30,9 @@ bool DomainAccountManager::checkAndSignalForAccessToken() {
if (!hasToken) {
// Emit a signal so somebody can call back to us and request an access token given a user name and password.
emit authRequired();
// Dialog can be hidden immediately after showing if we've just teleported to the domain, unless the signal is delayed.
QTimer::singleShot(500, this, [this] { emit this->authRequired(); });
}
return hasToken;