add error for login after signup, fix link style

This commit is contained in:
Stephen Birarda 2016-12-08 17:00:47 -08:00
parent 9445fc2898
commit 396c2bc28f
2 changed files with 24 additions and 5 deletions

View file

@ -22,6 +22,8 @@ Item {
width: root.pane.width
height: root.pane.height
property bool failAfterSignUp: false
function login() {
mainTextContainer.visible = false
loginDialog.login(usernameField.text, passwordField.text)
@ -96,7 +98,7 @@ Item {
}
width: 350
label: "User Name or Email"
label: "Username or Email"
}
ShortcutText {
@ -108,6 +110,7 @@ Item {
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
linkColor: hifi.colors.blueAccent
onLinkActivated: loginDialog.openUrl(link)
}
@ -135,6 +138,7 @@ Item {
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
linkColor: hifi.colors.blueAccent
onLinkActivated: loginDialog.openUrl(link)
}
@ -238,6 +242,11 @@ Item {
keyboardEnabled = HMD.active;
d.resize();
if (failAfterSignUp) {
mainTextContainer.text = "Account created successfully."
mainTextContainer.visible = true
}
usernameField.forceActiveFocus();
}

View file

@ -228,17 +228,27 @@ Item {
Connections {
target: loginDialog
onHandleSignupCompleted: {
console.log("Sign Up Succeeded")
console.log("Sign Up Succeeded");
bodyLoader.setSource("WelcomeBody.qml", { "welcomeBack": false })
bodyLoader.item.width = root.pane.width
bodyLoader.item.height = root.pane.height
// now that we have an account, login with that username and password
loginDialog.login(usernameField.text, "test")
}
onHandleSignupFailed: {
console.log("Sign Up Failed")
mainTextContainer.text = errorString
mainTextContainer.visible = true
}
onHandleLoginCompleted: {
bodyLoader.setSource("WelcomeBody.qml", { "welcomeBack": false })
bodyLoader.item.width = root.pane.width
bodyLoader.item.height = root.pane.height
}
onHandleLoginFailed: {
// we failed to login, show the LoginDialog so the user will try again
bodyLoader.setSource("LinkAccountBody.qml", { "failAfterSignUp": true })
bodyLoader.item.width = root.pane.width
bodyLoader.item.height = root.pane.height
}
}
Keys.onPressed: {