import QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.0 import org.yachat.app 1.0 Page { header: CustToolbar { title: qsTr("Login") } Login { id: login } ColumnLayout { Row { Layout.fillWidth: true Text { text: qsTr("Username: ") } TextField { id: username placeholderText: qsTr("Enter username") Component.onCompleted: { username.forceActiveFocus() } } } Row { Layout.fillWidth: true Text { text: qsTr("Password: ") } TextField { id: password placeholderText: qsTr("Enter password") echoMode: TextInput.Password } } Button { text: qsTr("Login") enabled: username.text && password.text onClicked: { login.start(username.text, password.text) } Connections { target: login function onAuthSuccess(client) { Yc.addAccount(client) Yc.storeAccount(client) } function onClose() { stack.pop() } } } Row { Text { id: error Connections { target: login function onError(msg) { error.text = msg } } } } } }