From 5a586260aeab91d53e9316bf3395a34a91cd8cc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Mon, 16 Sep 2019 21:21:22 +0800 Subject: Login flow for registered accounts --- Login.qml | 3 ++- kelakon.qrc | 3 +++ pages/CreateProfileForm.ui.qml | 4 +++- pages/EmailForm.ui.qml | 2 ++ pages/LoginName.qml | 19 +++++++++++++++++++ pages/LoginPass.qml | 20 ++++++++++++++++++++ pages/Profile.qml | 15 +++++++++++++++ 7 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 pages/LoginName.qml create mode 100644 pages/LoginPass.qml create mode 100644 pages/Profile.qml 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 @@ assets/user-24px.svg assets/email-24px.svg assets/lock-24px.svg + pages/LoginName.qml + pages/LoginPass.qml + pages/Profile.qml 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 +} -- cgit v1.2.3