diff --git a/interface/resources/qml/LoginDialog/LinkAccountBody.qml b/interface/resources/qml/LoginDialog/LinkAccountBody.qml index cd19662931..5c02de08d5 100644 --- a/interface/resources/qml/LoginDialog/LinkAccountBody.qml +++ b/interface/resources/qml/LoginDialog/LinkAccountBody.qml @@ -45,11 +45,8 @@ Item { property bool lostFocus: false readonly property bool loginDialogPoppedUp: loginDialog.getLoginDialogPoppedUp() - // TODO: - // readonly property bool isLoggingInToDomain: loginDialog.getDomainLoginRequested() - // readonly property bool domainAuthProvider: loginDialog.getDomainLoginAuthProvider() - readonly property bool isLoggingInToDomain: true - readonly property string domainAuthProvider: "https://example.com/oauth2" + readonly property bool isLoggingInToDomain: loginDialog.getDomainLoginRequested() + readonly property string domainAuthProvider: loginDialog.getDomainLoginAuthProvider() QtObject { id: d diff --git a/interface/resources/qml/LoginDialog/LoggingInBody.qml b/interface/resources/qml/LoginDialog/LoggingInBody.qml index 8824be8625..796798a2de 100644 --- a/interface/resources/qml/LoginDialog/LoggingInBody.qml +++ b/interface/resources/qml/LoginDialog/LoggingInBody.qml @@ -3,6 +3,7 @@ // // Created by Wayne Chen on 10/18/18 // Copyright 2018 High Fidelity, Inc. +// Copyright 2020 Vircadia contributors. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index c401733b09..72e6af74ec 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1356,7 +1356,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo connect(domainAccountManager.data(), &DomainAccountManager::authRequired, dialogsManager.data(), &DialogsManager::showDomainLoginDialog); - // ####### TODO + // ####### TODO: Connect any other signals from domainAccountManager. // use our MyAvatar position and quat for address manager path diff --git a/interface/src/ui/DialogsManager.cpp b/interface/src/ui/DialogsManager.cpp index c74342cb45..272c495789 100644 --- a/interface/src/ui/DialogsManager.cpp +++ b/interface/src/ui/DialogsManager.cpp @@ -111,10 +111,18 @@ void DialogsManager::setDomainConnectionFailureVisibility(bool visible) { } void DialogsManager::toggleLoginDialog() { + _isDomainLogin = false; LoginDialog::toggleAction(); } 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. + + _isDomainLogin = false; LoginDialog::showWithSelection(); } @@ -125,13 +133,15 @@ void DialogsManager::hideLoginDialog() { void DialogsManager::showDomainLoginDialog() { - // #######: TODO - qDebug() << "#######: showDomainLoginDialog()"; + _isDomainLogin = true; + LoginDialog::showWithSelection(); } -// #######: TODO +// #######: TODO: Domain version of toggleLoginDialog()? + +// #######: TODO: Domain version of hiadLoginDialog()? void DialogsManager::showUpdateDialog() { diff --git a/interface/src/ui/DialogsManager.h b/interface/src/ui/DialogsManager.h index 6e701df9ef..30127ced68 100644 --- a/interface/src/ui/DialogsManager.h +++ b/interface/src/ui/DialogsManager.h @@ -41,6 +41,7 @@ public: QPointer getTestingDialog() const { return _testingDialog; } void emitAddressBarShown(bool visible) { emit addressBarShown(visible); } void setAddressBarVisible(bool addressBarVisible); + bool getIsDomainLogin() { return _isDomainLogin; } public slots: void showAddressBar(); @@ -84,6 +85,8 @@ private: QPointer _domainConnectionDialog; bool _dialogCreatedWhileShown { false }; bool _addressBarVisible { false }; + + bool _isDomainLogin { false }; }; #endif // hifi_DialogsManager_h diff --git a/interface/src/ui/LoginDialog.cpp b/interface/src/ui/LoginDialog.cpp index ca9ae4282d..f185b0ab2b 100644 --- a/interface/src/ui/LoginDialog.cpp +++ b/interface/src/ui/LoginDialog.cpp @@ -4,6 +4,7 @@ // // Created by Bradley Austin Davis on 2015/04/14 // Copyright 2015 High Fidelity, Inc. +// Copyright 2020 Vircadia contributors. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -25,6 +26,7 @@ #include "AccountManager.h" #include "DependencyManager.h" +#include "DialogsManager.h" #include "Menu.h" #include "Application.h" @@ -135,10 +137,15 @@ void LoginDialog::login(const QString& username, const QString& password) const DependencyManager::get()->requestAccessToken(username, password); } -void LoginDialog::loginDomain(const QString& username, const QString& password, const QUrl domainAuthProvider) const { +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; - // TODO: + // ####### TODO // DependencyManager::get()->requestAccessToken(username, password, domainAuthProvider); + + // ####### TODO: It may not be necessary to pass domainAuthProvider to the login dialog and through to here because it was + // originally provided to the QML from C++. } void LoginDialog::loginThroughOculus() { @@ -416,3 +423,13 @@ void LoginDialog::signupFailed(QNetworkReply* reply) { emit handleSignupFailed(DEFAULT_SIGN_UP_FAILURE_MESSAGE); } } + +bool LoginDialog::getDomainLoginRequested() const { + return DependencyManager::get()->getIsDomainLogin(); +} + +// ####### TODO: This method may not be necessary. +QString LoginDialog::getDomainLoginAuthProvider() const { + // ####### TODO + return QString("https://example.com/oauth2"); +} diff --git a/interface/src/ui/LoginDialog.h b/interface/src/ui/LoginDialog.h index 6ccef3fa39..49d5dc8fac 100644 --- a/interface/src/ui/LoginDialog.h +++ b/interface/src/ui/LoginDialog.h @@ -4,6 +4,7 @@ // // Created by Bradley Austin Davis on 2015/04/14 // Copyright 2015 High Fidelity, Inc. +// Copyright 2020 Vircadia contributors. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -71,7 +72,7 @@ protected slots: Q_INVOKABLE QString oculusUserID() const; Q_INVOKABLE void login(const QString& username, const QString& password) const; - Q_INVOKABLE void loginDomain(const QString& username, const QString& password, const QUrl domainAuthProvider) const; + Q_INVOKABLE void loginDomain(const QString& username, const QString& password, const QString& domainAuthProvider) const; Q_INVOKABLE void loginThroughSteam(); Q_INVOKABLE void linkSteam(); Q_INVOKABLE void createAccountFromSteam(QString username = QString()); @@ -82,6 +83,10 @@ protected slots: Q_INVOKABLE void signup(const QString& email, const QString& username, const QString& password); Q_INVOKABLE bool getLoginDialogPoppedUp() const; + + Q_INVOKABLE bool getDomainLoginRequested() const; + Q_INVOKABLE QString getDomainLoginAuthProvider() const; + }; #endif // hifi_LoginDialog_h