on xenial help sign in
save the email and real name in AS, tweak the lock screen to offer 2 password choices
commit0ae25bf41a7c0efb2a0c0c376fc003870ce1adb8 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateWed 9 Sep 2015, 20:57 (11 years ago) parent9a4ba2f
3 files changed+63−64
qml/Wizard/Pages/60-uaccount-signup.qml+36−33 qml/Wizard/Pages/70-passwd-type.qml+25−30 qml/Wizard/Pages/80-finished.qml+2−1
qml/Wizard/Pages/60-uaccount-signup.qml+36−33
@@ -17,6 +17,7 @@
1717import QtQuick 2.3
1818import Ubuntu.Components 1.2
1919import Ubuntu.Web 0.2
20+import AccountsService 0.1
2021import ".." as LocalComponents
2122
2223LocalComponents.Page {
@@ -153,38 +154,36 @@ LocalComponents.Page {
153154 anchors.top: pass2Input.bottom
154155 anchors.topMargin: units.gu(2)
155156 text: i18n.tr("Encrypt my content")
156− KeyNavigation.tab: termsCheck
157− }
158−
159− LocalComponents.CheckableSetting {
160− id: optoutCheck
161− objectName: "optoutCheck"
162− showDivider: false
163− anchors.left: parent.left
164− anchors.right: parent.right
165− anchors.top: encryptCheck.bottom
166− anchors.topMargin: units.gu(2)
167− text: i18n.tr("Opt out of cloud account (not recommended)")
168− KeyNavigation.tab: termsCheck
169− visible: false // TODO re-enable in Phase 2
170− }
171−
172− LocalComponents.CheckableSetting {
173− id: termsCheck
174− objectName: "termsCheck"
175− showDivider: false
176− anchors.left: parent.left
177− anchors.right: parent.right
178− anchors.top: encryptCheck.bottom
179− anchors.topMargin: units.gu(1)
180− text: i18n.tr("I have read and accept the Ubuntu account <a href='#'>terms of service</a>")
181− onLinkActivated: {
182− webview.visible = true;
183− webview.url = "https://login.ubuntu.com/terms/";
184− }
185157 KeyNavigation.tab: emailInput
186− visible: true
187158 }
159+
160+// LocalComponents.CheckableSetting {
161+// id: optoutCheck
162+// objectName: "optoutCheck"
163+// showDivider: false
164+// anchors.left: parent.left
165+// anchors.right: parent.right
166+// anchors.top: encryptCheck.bottom
167+// anchors.topMargin: units.gu(2)
168+// text: i18n.tr("Opt out of cloud account (not recommended)")
169+// KeyNavigation.tab: termsCheck
170+// }
171+
172+// LocalComponents.CheckableSetting {
173+// id: termsCheck
174+// objectName: "termsCheck"
175+// showDivider: false
176+// anchors.left: parent.left
177+// anchors.right: parent.right
178+// anchors.top: encryptCheck.bottom
179+// anchors.topMargin: units.gu(1)
180+// text: i18n.tr("I have read and accept the Ubuntu account <a href='#'>terms of service</a>")
181+// onLinkActivated: {
182+// webview.visible = true;
183+// webview.url = "https://login.ubuntu.com/terms/";
184+// }
185+// KeyNavigation.tab: emailInput
186+// }
188187 }
189188
190189 WebView {
@@ -198,10 +197,14 @@ LocalComponents.Page {
198197 id: forwardButton
199198 LocalComponents.StackButton {
200199 enabled: emailInput.acceptableInput && nameInput.text !== "" &&
201− pass2Input.text.length > 7 && passInput.text === pass2Input.text &&
202− termsCheck.checked
200+ pass2Input.text.length > 7 && passInput.text === pass2Input.text
203201 text: i18n.tr("Sign Up")
204− onClicked: pageStack.next() // TODO sign up against U1
202+ onClicked: {
203+ root.password = passInput.text;
204+ AccountsService.realName = nameInput.text;
205+ AccountsService.email = emailInput.text;
206+ pageStack.next() // TODO sign up against U1 in Phase 2
207+ }
205208 }
206209 }
207210}
qml/Wizard/Pages/70-passwd-type.qml+25−30
@@ -39,25 +39,19 @@ LocalComponents.Page {
3939 forwardButtonSourceComponent: forwardButton
4040
4141 function indexToMethod(index) {
42− if (index === 1)
43− return UbuntuSecurityPrivacyPanel.Passcode;
44− else if (index === 0)
42+ if (index === 0 || index === 1)
4543 return UbuntuSecurityPrivacyPanel.Passphrase;
44+ else if (index === 2)
45+ return UbuntuSecurityPrivacyPanel.Passcode;
4646 else
4747 return UbuntuSecurityPrivacyPanel.Swipe;
4848 }
4949
50− function methodToIndex(method) {
51− if (method === UbuntuSecurityPrivacyPanel.Passcode)
52− return 1;
53− else if (method === UbuntuSecurityPrivacyPanel.Passphrase)
54− return 0;
55− else
56− return 2;
57− }
58−
5950 Component.onCompleted: {
60− selector.currentIndex = methodToIndex(root.passwordMethod);
51+ if (root.password !== "") // the user has set a password as part of the previous page
52+ selector.currentIndex = 0;
53+ else
54+ selector.currentIndex = 1;
6155 }
6256
6357 Item {
@@ -97,7 +91,8 @@ LocalComponents.Page {
9791 height: childrenRect.height
9892
9993 // this is the order we want to display it; cf indexToMethod()
100− model: [UbuntuSecurityPrivacyPanel.Passphrase, UbuntuSecurityPrivacyPanel.Passcode, UbuntuSecurityPrivacyPanel.Swipe]
94+ model: [UbuntuSecurityPrivacyPanel.Passphrase, UbuntuSecurityPrivacyPanel.Passphrase,
95+ UbuntuSecurityPrivacyPanel.Passcode, UbuntuSecurityPrivacyPanel.Swipe]
10196
10297 delegate: ListItem {
10398 id: itemDelegate
@@ -115,19 +110,16 @@ LocalComponents.Page {
115110 color: textColor
116111 font.weight: itemDelegate.isCurrent ? Font.Normal : Font.Light
117112 text: {
118− var method = modelData
119− var name = ""
120− var desc = ""
121− if (method === UbuntuSecurityPrivacyPanel.Swipe) {
122− return i18n.ctr("Label: Type of security method", "None");
123− } else if (method === UbuntuSecurityPrivacyPanel.Passcode) {
124− name = i18n.ctr("Label: Type of security method", "Passcode");
125− desc = i18n.ctr("Label: Description of security method", "4 digits only");
126− } else {
127− name = i18n.ctr("Label: Type of security method", "Password");
128− desc = i18n.ctr("Label: Description of security method", "numbers and letters");
113+ switch (index) {
114+ case 0:
115+ return i18n.ctr("Label: Type of security method", "Device account password");
116+ case 1:
117+ return i18n.ctr("Label: Type of security method", "New password");
118+ case 2:
119+ return i18n.ctr("Label: Type of security method", "Passcode");
120+ case 3:
121+ return i18n.ctr("Label: Type of security method", "Swipe");
129122 }
130− return "%1 (%2)".arg(name).arg(desc);
131123 }
132124 }
133125
@@ -170,11 +162,14 @@ LocalComponents.Page {
170162 root.passwordMethod = method;
171163 print("Current method: " + root.passwordMethod);
172164
173− if (method === UbuntuSecurityPrivacyPanel.Passphrase) {
174− pageStack.load(Qt.resolvedUrl("password-set.qml"));
175− } else if (method === UbuntuSecurityPrivacyPanel.Passcode) {
165+ if (method === UbuntuSecurityPrivacyPanel.Passphrase) { // any password
166+ if (selector.currentIndex == 1)
167+ pageStack.load(Qt.resolvedUrl("password-set.qml")); // let the user choose a new password
168+ else
169+ pageStack.next(); // got the password already, go next page
170+ } else if (method === UbuntuSecurityPrivacyPanel.Passcode) { // passcode
176171 pageStack.load(Qt.resolvedUrl("passcode-set.qml"));
177− } else {
172+ } else { //swipe
178173 pageStack.next();
179174 }
180175 }
qml/Wizard/Pages/80-finished.qml+2−1
@@ -65,7 +65,8 @@ LocalComponents.Page {
6565 text: i18n.tr("Get Started")
6666 color: "transparent"
6767 strokeColor: "white"
68− font.pixelSize: FontUtils.sizeToPixels("large")
68+ font.weight: Font.Normal
69+ font.pixelSize: FontUtils.sizeToPixels("medium")
6970 onClicked: {
7071 root.quitWizard();
7172 }