summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-09-16 21:21:22 +0800
committerꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-09-16 21:21:22 +0800
commit5a586260aeab91d53e9316bf3395a34a91cd8cc0 (patch)
treea8b29b4097c78463ada8716c32f28e4d2a0670a8
parent1be4acfe8c0368b5f464d8f1ee3e9cc6f862662a (diff)
Login flow
for registered accounts
-rw-r--r--Login.qml3
-rw-r--r--kelakon.qrc3
-rw-r--r--pages/CreateProfileForm.ui.qml4
-rw-r--r--pages/EmailForm.ui.qml2
-rw-r--r--pages/LoginName.qml19
-rw-r--r--pages/LoginPass.qml20
-rw-r--r--pages/Profile.qml15
7 files changed, 64 insertions, 2 deletions
diff --git a/Login.qml b/Login.qml
index 59b0dd5..d6accbe 100644
--- a/Login.qml
+++ b/Login.qml
@@ -4,11 +4,12 @@ LoginForm {
signal logIn(string name, string password)
signal search(string name)
function pushProfile() {
- stackView.push("qrc:/pages/CreateProfile.qml")
+ stackView.push("qrc:/pages/Profile.qml")
}
objectName: "login"
width: appWindow.width
height: appWindow.height
+ googleButton.onClicked: stackView.push("qrc:/pages/LoginName.qml")
emailButton.onClicked: stackView.push("qrc:/pages/Email.qml")
}
diff --git a/kelakon.qrc b/kelakon.qrc
index d6837c0..b4e44ca 100644
--- a/kelakon.qrc
+++ b/kelakon.qrc
@@ -32,5 +32,8 @@
<file>assets/user-24px.svg</file>
<file>assets/email-24px.svg</file>
<file>assets/lock-24px.svg</file>
+ <file>pages/LoginName.qml</file>
+ <file>pages/LoginPass.qml</file>
+ <file>pages/Profile.qml</file>
</qresource>
</RCC>
diff --git a/pages/CreateProfileForm.ui.qml b/pages/CreateProfileForm.ui.qml
index 45087e1..d63e9ee 100644
--- a/pages/CreateProfileForm.ui.qml
+++ b/pages/CreateProfileForm.ui.qml
@@ -9,8 +9,9 @@ Rectangle {
property alias backButton: backButton
property alias skipButton: skipButton
- property alias emailAddressLabel: emailAddressLabel
property alias enterFullName: enterFullName
+ property alias userNameLabel: userNameLabel
+ property alias emailAddressLabel: emailAddressLabel
ToolBar {
id: toolbar
@@ -139,6 +140,7 @@ Rectangle {
}
TextField {
+ id: userNameLabel
Layout.rightMargin: 16
Layout.leftMargin: 24
font.pointSize: 16
diff --git a/pages/EmailForm.ui.qml b/pages/EmailForm.ui.qml
index c2325fc..dc679ab 100644
--- a/pages/EmailForm.ui.qml
+++ b/pages/EmailForm.ui.qml
@@ -9,6 +9,7 @@ Rectangle {
border.width: 0
property alias backButton: backButton
+ property alias instructionLabel: instructionLabel
property alias emailTextField: emailTextField
property alias loginButton: loginButton
@@ -40,6 +41,7 @@ Rectangle {
}
Label {
+ id: instructionLabel
x: 16
y: 398
color: "#2b2626"
diff --git a/pages/LoginName.qml b/pages/LoginName.qml
new file mode 100644
index 0000000..72b069b
--- /dev/null
+++ b/pages/LoginName.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.12
+import KelakonUser 0.1
+
+EmailForm {
+ width: stackView.width
+ height: stackView.height
+ backButton.onClicked: stackView.pop()
+ instructionLabel.text: qsTr("Enter e-mail")
+
+ emailTextField.onTextChanged: {
+ if (!emailTextField.text || !loginButton.enabled)
+ loginButton.enabled = !loginButton.enabled
+ }
+
+ loginButton.onClicked: {
+ User.name = emailTextField.text
+ stackView.push("qrc:/pages/LoginPass.qml")
+ }
+}
diff --git a/pages/LoginPass.qml b/pages/LoginPass.qml
new file mode 100644
index 0000000..9e5d2f4
--- /dev/null
+++ b/pages/LoginPass.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.12
+import KelakonUser 0.1
+
+PasswordForm {
+ width: stackView.width
+ height: stackView.height
+ backButton.onClicked: stackView.pop()
+ instructionLabel.text: qsTr("Enter password")
+ emailAddressLabel.text: User.name
+
+ passTextField.onTextChanged: {
+ if (!passTextField.text || !createPassButton.enabled)
+ createPassButton.enabled = !createPassButton.enabled
+ }
+
+ createPassButton.onClicked: {
+ User.password = passTextField.text
+ onClicked: login.logIn(User.name, User.password)
+ }
+}
diff --git a/pages/Profile.qml b/pages/Profile.qml
new file mode 100644
index 0000000..89dd09e
--- /dev/null
+++ b/pages/Profile.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.12
+import KelakonUser 0.1
+
+CreateProfileForm {
+ width: stackView.width
+ height: stackView.height
+ backButton.onClicked: stackView.pop()
+ skipButton.onClicked: {
+ login.search(User.name)
+ stackView.push("qrc:/pages/Home.qml")
+ }
+ enterFullName.text: User.realName
+ userNameLabel.text: User.name
+ emailAddressLabel.text: User.emailAddress
+}