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

View file

@ -228,17 +228,27 @@ Item {
Connections { Connections {
target: loginDialog target: loginDialog
onHandleSignupCompleted: { onHandleSignupCompleted: {
console.log("Sign Up Succeeded") console.log("Sign Up Succeeded");
bodyLoader.setSource("WelcomeBody.qml", { "welcomeBack": false }) // now that we have an account, login with that username and password
bodyLoader.item.width = root.pane.width loginDialog.login(usernameField.text, "test")
bodyLoader.item.height = root.pane.height
} }
onHandleSignupFailed: { onHandleSignupFailed: {
console.log("Sign Up Failed") console.log("Sign Up Failed")
mainTextContainer.text = errorString mainTextContainer.text = errorString
mainTextContainer.visible = true 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: { Keys.onPressed: {