Show error messages on login screen

This commit is contained in:
miruka
2019-08-16 16:30:18 -04:00
parent e920299db4
commit c7adb5b02f
5 changed files with 39 additions and 10 deletions

View File

@@ -26,8 +26,14 @@ Item {
button.loading = true
let args = [idField.text, passwordField.text]
py.callCoro("login_client", args, userId => {
pageStack.showPage("RememberAccount", {loginWith, userId})
py.callCoro("login_client", args, ([success, data]) => {
if (success) {
// data = userId
errorMessage.text = ""
pageStack.showPage("RememberAccount", {loginWith,data})
} else {
errorMessage.text = qsTr(data)
}
button.loading = false
})
},
@@ -77,5 +83,19 @@ Item {
Layout.fillWidth: true
Layout.margins: signInBox.margins
}
HLabel {
id: errorMessage
wrapMode: Text.Wrap
horizontalAlignment: Text.AlignHCenter
color: theme.colors.errorText
visible: Layout.maximumHeight > 0
Layout.maximumHeight: text ? implicitHeight : 0
Behavior on Layout.maximumHeight { HNumberAnimation {} }
Layout.fillWidth: true
Layout.margins: signInBox.margins
}
}
}