summaryrefslogtreecommitdiff
path: root/Login.qml
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2026-02-04 11:34:38 +0100
committerXavier Del Campo Romero <xavi92@disroot.org>2026-02-04 15:24:48 +0100
commit23cc4be5bc02328fe73ccbd67493dd71ef2e2b8f (patch)
treeb9e1a7a416f004d96671c0abf597524946b9dda3 /Login.qml
parent3b9973552ec613b37fb511f3a0ae24dacb1e4366 (diff)
downloadyachat6-23cc4be5bc02328fe73ccbd67493dd71ef2e2b8f.tar.gz
Add accounts and login pages
Diffstat (limited to 'Login.qml')
-rw-r--r--Login.qml101
1 files changed, 101 insertions, 0 deletions
diff --git a/Login.qml b/Login.qml
new file mode 100644
index 0000000..24354f6
--- /dev/null
+++ b/Login.qml
@@ -0,0 +1,101 @@
+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
+ }
+ }
+ }
+ }
+ }
+}