Provide domain name to domain login dialog

This commit is contained in:
David Rowe 2020-08-04 19:42:02 +12:00
parent bc56eb5ac7
commit 3a43283e7b
7 changed files with 26 additions and 7 deletions

View file

@ -46,6 +46,7 @@ Item {
readonly property bool loginDialogPoppedUp: loginDialog.getLoginDialogPoppedUp() readonly property bool loginDialogPoppedUp: loginDialog.getLoginDialogPoppedUp()
readonly property bool isLoggingInToDomain: loginDialog.getDomainLoginRequested() readonly property bool isLoggingInToDomain: loginDialog.getDomainLoginRequested()
readonly property string domainLoginDomain: loginDialog.getDomainLoginDomain()
QtObject { QtObject {
id: d id: d

View file

@ -110,8 +110,14 @@ void DialogsManager::setDomainConnectionFailureVisibility(bool visible) {
} }
} }
void DialogsManager::setDomainLogin(bool isDomainLogin, const QString& domain) {
_isDomainLogin = isDomainLogin;
_domainLoginDomain = domain;
}
void DialogsManager::toggleLoginDialog() { void DialogsManager::toggleLoginDialog() {
_isDomainLogin = false; setDomainLogin(false);
LoginDialog::toggleAction(); LoginDialog::toggleAction();
} }
@ -120,7 +126,7 @@ void DialogsManager::showLoginDialog() {
// ####### TODO: May be called from script via DialogsManagerScriptingInterface. Need to handle the case that it's already // ####### 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. // displayed and may be the domain login version.
_isDomainLogin = false; setDomainLogin(false);
LoginDialog::showWithSelection(); LoginDialog::showWithSelection();
} }
@ -129,8 +135,8 @@ void DialogsManager::hideLoginDialog() {
} }
void DialogsManager::showDomainLoginDialog() { void DialogsManager::showDomainLoginDialog(const QString& domain) {
_isDomainLogin = true; setDomainLogin(true, domain);
LoginDialog::showWithSelection(); LoginDialog::showWithSelection();
} }

View file

@ -42,6 +42,7 @@ public:
void emitAddressBarShown(bool visible) { emit addressBarShown(visible); } void emitAddressBarShown(bool visible) { emit addressBarShown(visible); }
void setAddressBarVisible(bool addressBarVisible); void setAddressBarVisible(bool addressBarVisible);
bool getIsDomainLogin() { return _isDomainLogin; } bool getIsDomainLogin() { return _isDomainLogin; }
QString getDomainLoginDomain() { return _domainLoginDomain; }
public slots: public slots:
void showAddressBar(); void showAddressBar();
@ -51,7 +52,7 @@ public slots:
void toggleLoginDialog(); void toggleLoginDialog();
void showLoginDialog(); void showLoginDialog();
void hideLoginDialog(); void hideLoginDialog();
void showDomainLoginDialog(); void showDomainLoginDialog(const QString& domain);
void octreeStatsDetails(); void octreeStatsDetails();
void lodTools(); void lodTools();
void hmdTools(bool showTools); void hmdTools(bool showTools);
@ -86,7 +87,9 @@ private:
bool _dialogCreatedWhileShown { false }; bool _dialogCreatedWhileShown { false };
bool _addressBarVisible { false }; bool _addressBarVisible { false };
void setDomainLogin(bool isDomainLogin, const QString& domain = "");
bool _isDomainLogin { false }; bool _isDomainLogin { false };
QString _domainLoginDomain;
}; };
#endif // hifi_DialogsManager_h #endif // hifi_DialogsManager_h

View file

@ -427,3 +427,7 @@ void LoginDialog::signupFailed(QNetworkReply* reply) {
bool LoginDialog::getDomainLoginRequested() const { bool LoginDialog::getDomainLoginRequested() const {
return DependencyManager::get<DialogsManager>()->getIsDomainLogin(); return DependencyManager::get<DialogsManager>()->getIsDomainLogin();
} }
QString LoginDialog::getDomainLoginDomain() const {
return DependencyManager::get<DialogsManager>()->getDomainLoginDomain();
}

View file

@ -85,6 +85,7 @@ protected slots:
Q_INVOKABLE bool getLoginDialogPoppedUp() const; Q_INVOKABLE bool getLoginDialogPoppedUp() const;
Q_INVOKABLE bool getDomainLoginRequested() const; Q_INVOKABLE bool getDomainLoginRequested() const;
Q_INVOKABLE QString getDomainLoginDomain() const;
}; };

View file

@ -184,7 +184,10 @@ bool DomainAccountManager::checkAndSignalForAccessToken() {
// Emit a signal so somebody can call back to us and request an access token given a user name and password. // Emit a signal so somebody can call back to us and request an access token given a user name and password.
// Dialog can be hidden immediately after showing if we've just teleported to the domain, unless the signal is delayed. // 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(); }); auto domain = _authURL.host();
QTimer::singleShot(500, this, [this, domain] {
emit this->authRequired(domain);
});
} }
return hasToken; return hasToken;

View file

@ -36,8 +36,9 @@ public slots:
void requestAccessToken(const QString& username, const QString& password); void requestAccessToken(const QString& username, const QString& password);
void requestAccessTokenFinished(); void requestAccessTokenFinished();
signals: signals:
void authRequired(); void authRequired(const QString& domain);
void loginComplete(); void loginComplete();
void loginFailed(); void loginFailed();
void logoutComplete(); void logoutComplete();