Wire up domain login dialog

This commit is contained in:
David Rowe 2020-07-25 20:40:52 +12:00
parent fec0e7a8bc
commit 0618427d0f
7 changed files with 45 additions and 12 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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() {

View file

@ -41,6 +41,7 @@ public:
QPointer<TestingDialog> 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> _domainConnectionDialog;
bool _dialogCreatedWhileShown { false };
bool _addressBarVisible { false };
bool _isDomainLogin { false };
};
#endif // hifi_DialogsManager_h

View file

@ -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<AccountManager>()->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<DomainAccountManager>()->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<DialogsManager>()->getIsDomainLogin();
}
// ####### TODO: This method may not be necessary.
QString LoginDialog::getDomainLoginAuthProvider() const {
// ####### TODO
return QString("https://example.com/oauth2");
}

View file

@ -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