Merge branch 'loginInitiative2' of https://github.com/wayne-chen/hifi into loginInitiative2

This commit is contained in:
Wayne Chen 2018-10-23 08:51:45 -07:00
commit c087b0f196
2 changed files with 23 additions and 9 deletions

View file

@ -28,6 +28,7 @@ Item {
property bool keyboardRaised: false property bool keyboardRaised: false
property bool punctuationMode: false property bool punctuationMode: false
property bool isLogIn: false
property bool withSteam: false property bool withSteam: false
onKeyboardRaisedChanged: d.resize(); onKeyboardRaisedChanged: d.resize();
@ -58,9 +59,18 @@ Item {
} }
} }
function toggleLoggingIn(loggingIn) { function login() {
if (linkAccountBody.isLogIn) {
loginDialog.login(emailField.text, passwordField.text);
} else {
loginDialog.signup(emailField.text, usernameField.text, passwordField.text);
}
linkAccountBody.toggleLoggingIn();
}
function toggleLoggingIn() {
// For the process of logging in. // For the process of logging in.
if (withSteam) { if (linkAccountBody.withSteam) {
} }
else { else {
@ -70,6 +80,7 @@ Item {
function toggleSignIn(signIn, isLogIn) { function toggleSignIn(signIn, isLogIn) {
// going to/from sign in/up dialog. // going to/from sign in/up dialog.
linkAccountBody.isLogIn = isLogIn;
if (signIn) { if (signIn) {
usernameField.visible = !isLogIn; usernameField.visible = !isLogIn;
cantAccessContainer.visible = isLogIn; cantAccessContainer.visible = isLogIn;
@ -189,6 +200,7 @@ Item {
} }
onFocusChanged: { onFocusChanged: {
root.isPassword = true;
} }
Rectangle { Rectangle {
@ -227,20 +239,20 @@ Item {
} }
} }
Keys.onReturnPressed: { Keys.onReturnPressed: {
signInBody.login() linkAccountBody.login()
} }
} }
HifiControlsUit.CheckBox { HifiControlsUit.CheckBox {
id: autoLogoutCheckbox id: autoLogoutCheckbox
checked: !Settings.getValue("wallet/autoLogout", true) checked: !Settings.getValue("wallet/autoLogout", false);
text: "Keep Me Logged In" text: qsTr("Keep Me Logged In")
boxSize: 18; boxSize: 18;
labelFontSize: 18; labelFontSize: 18;
color: hifi.colors.white; color: hifi.colors.white;
anchors { anchors {
top: passwordField.bottom top: passwordField.bottom;
topMargin: hifi.dimensions.contentSpacing.y topMargin: hifi.dimensions.contentSpacing.y;
right: passwordField.right right: passwordField.right;
} }
onCheckedChanged: { onCheckedChanged: {
Settings.setValue("wallet/autoLogout", !checked); Settings.setValue("wallet/autoLogout", !checked);

View file

@ -122,7 +122,6 @@ TabletModalWindow {
id: bodyLoader id: bodyLoader
anchors.fill: parent anchors.fill: parent
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
source: loginDialog.isSteamRunning() ? "../LoginDialog/SignInBody.qml" : "../LoginDialog/LinkAccountBody.qml"
} }
} }
} }
@ -173,4 +172,7 @@ TabletModalWindow {
break break
} }
} }
Component.onCompleted: {
bodyLoader.setSource("../LoginDialog/LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root });
}
} }