on xenial help sign in
save the email and real name in AS, tweak the lock screen to offer 2 password choices
0ae25bfLukáš Tinkl
qml/Wizard/Pages/60-uaccount-signup.qml+36−33
@@ -17,6 +17,7 @@
17import QtQuick 2.3
17import QtQuick 2.3
18import Ubuntu.Components 1.2
18import Ubuntu.Components 1.2
19import Ubuntu.Web 0.2
19import Ubuntu.Web 0.2
20+import AccountsService 0.1
20import ".." as LocalComponents
21import ".." as LocalComponents
21
22
22LocalComponents.Page {
23LocalComponents.Page {
@@ -153,38 +154,36 @@ LocalComponents.Page {
153 anchors.top: pass2Input.bottom
154 anchors.top: pass2Input.bottom
154 anchors.topMargin: units.gu(2)
155 anchors.topMargin: units.gu(2)
155 text: i18n.tr("Encrypt my content")
156 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− }
185 KeyNavigation.tab: emailInput
157 KeyNavigation.tab: emailInput
186− visible: true
187 }
158 }
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+// }
188 }
187 }
189
188
190 WebView {
189 WebView {
@@ -198,10 +197,14 @@ LocalComponents.Page {
198 id: forwardButton
197 id: forwardButton
199 LocalComponents.StackButton {
198 LocalComponents.StackButton {
200 enabled: emailInput.acceptableInput && nameInput.text !== "" &&
199 enabled: emailInput.acceptableInput && nameInput.text !== "" &&
201− pass2Input.text.length > 7 && passInput.text === pass2Input.text &&
200+ pass2Input.text.length > 7 && passInput.text === pass2Input.text
202− termsCheck.checked
203 text: i18n.tr("Sign Up")
201 text: i18n.tr("Sign Up")
202+ onClicked: {
203+ root.password = passInput.text;
204+ AccountsService.realName = nameInput.text;
205+ AccountsService.email = emailInput.text;
204− onClicked: pageStack.next() // TODO sign up against U1
206+ pageStack.next() // TODO sign up against U1 in Phase 2
207+ }
205 }
208 }
206 }
209 }
207}
210}
qml/Wizard/Pages/70-passwd-type.qml+25−30
@@ -39,25 +39,19 @@ LocalComponents.Page {
39 forwardButtonSourceComponent: forwardButton
39 forwardButtonSourceComponent: forwardButton
40
40
41 function indexToMethod(index) {
41 function indexToMethod(index) {
42− if (index === 1)
42+ if (index === 0 || index === 1)
43− return UbuntuSecurityPrivacyPanel.Passcode;
44− else if (index === 0)
45 return UbuntuSecurityPrivacyPanel.Passphrase;
43 return UbuntuSecurityPrivacyPanel.Passphrase;
44+ else if (index === 2)
45+ return UbuntuSecurityPrivacyPanel.Passcode;
46 else
46 else
47 return UbuntuSecurityPrivacyPanel.Swipe;
47 return UbuntuSecurityPrivacyPanel.Swipe;
48 }
48 }
49
49
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−
59 Component.onCompleted: {
50 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;
61 }
55 }
62
56
63 Item {
57 Item {
@@ -97,7 +91,8 @@ LocalComponents.Page {
97 height: childrenRect.height
91 height: childrenRect.height
98
92
99 // this is the order we want to display it; cf indexToMethod()
93 // 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]
101
96
102 delegate: ListItem {
97 delegate: ListItem {
103 id: itemDelegate
98 id: itemDelegate
@@ -115,19 +110,16 @@ LocalComponents.Page {
115 color: textColor
110 color: textColor
116 font.weight: itemDelegate.isCurrent ? Font.Normal : Font.Light
111 font.weight: itemDelegate.isCurrent ? Font.Normal : Font.Light
117 text: {
112 text: {
118− var method = modelData
113+ switch (index) {
119− var name = ""
114+ case 0:
120− var desc = ""
115+ return i18n.ctr("Label: Type of security method", "Device account password");
121− if (method === UbuntuSecurityPrivacyPanel.Swipe) {
116+ case 1:
122− return i18n.ctr("Label: Type of security method", "None");
117+ return i18n.ctr("Label: Type of security method", "New password");
123− } else if (method === UbuntuSecurityPrivacyPanel.Passcode) {
118+ case 2:
124− name = i18n.ctr("Label: Type of security method", "Passcode");
119+ return i18n.ctr("Label: Type of security method", "Passcode");
125− desc = i18n.ctr("Label: Description of security method", "4 digits only");
120+ case 3:
126− } else {
121+ return i18n.ctr("Label: Type of security method", "Swipe");
127− name = i18n.ctr("Label: Type of security method", "Password");
128− desc = i18n.ctr("Label: Description of security method", "numbers and letters");
129 }
122 }
130− return "%1 (%2)".arg(name).arg(desc);
131 }
123 }
132 }
124 }
133
125
@@ -170,11 +162,14 @@ LocalComponents.Page {
170 root.passwordMethod = method;
162 root.passwordMethod = method;
171 print("Current method: " + root.passwordMethod);
163 print("Current method: " + root.passwordMethod);
172
164
173− if (method === UbuntuSecurityPrivacyPanel.Passphrase) {
165+ if (method === UbuntuSecurityPrivacyPanel.Passphrase) { // any password
166+ if (selector.currentIndex == 1)
174− pageStack.load(Qt.resolvedUrl("password-set.qml"));
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
175− } else if (method === UbuntuSecurityPrivacyPanel.Passcode) {
170+ } else if (method === UbuntuSecurityPrivacyPanel.Passcode) { // passcode
176 pageStack.load(Qt.resolvedUrl("passcode-set.qml"));
171 pageStack.load(Qt.resolvedUrl("passcode-set.qml"));
177− } else {
172+ } else { //swipe
178 pageStack.next();
173 pageStack.next();
179 }
174 }
180 }
175 }
qml/Wizard/Pages/80-finished.qml+2−1
@@ -65,7 +65,8 @@ LocalComponents.Page {
65 text: i18n.tr("Get Started")
65 text: i18n.tr("Get Started")
66 color: "transparent"
66 color: "transparent"
67 strokeColor: "white"
67 strokeColor: "white"
68+ font.weight: Font.Normal
68− font.pixelSize: FontUtils.sizeToPixels("large")
69+ font.pixelSize: FontUtils.sizeToPixels("medium")
69 onClicked: {
70 onClicked: {
70 root.quitWizard();
71 root.quitWizard();
71 }
72 }