on xenial help sign in
drop all references to LighDM from the Lockscreen
9802b81Michael Zanetti
Greeter/Lockscreen.qml+6−18
@@ -17,7 +17,6 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import Ubuntu.Components 0.1
18import Ubuntu.Components 0.1
19import "../Components"
19import "../Components"
20−import LightDM 0.1 as LightDM
21
20
22Showable {
21Showable {
23 id: root
22 id: root
@@ -37,7 +36,7 @@ Showable {
37
36
38 property url background: ""
37 property url background: ""
39
38
40− signal unlocked()
39+ signal entered(string passphrase)
41 signal cancel()
40 signal cancel()
42 signal emergencyCall()
41 signal emergencyCall()
43
42
@@ -53,6 +52,10 @@ Showable {
53 pinPadLoader.resetting = false;
52 pinPadLoader.resetting = false;
54 }
53 }
55
54
55+ function clear(showAnimation) {
56+ pinPadLoader.item.clear(showAnimation);
57+ }
58+
56 Rectangle {
59 Rectangle {
57 // In case background fails to load or is undefined
60 // In case background fails to load or is undefined
58 id: backgroundBackup
61 id: backgroundBackup
@@ -92,7 +95,7 @@ Showable {
92 target: pinPadLoader.item
95 target: pinPadLoader.item
93
96
94 onEntered: {
97 onEntered: {
95− LightDM.Greeter.respond(passphrase);
98+ root.entered(passphrase);
96 }
99 }
97
100
98 onCancel: {
101 onCancel: {
@@ -150,19 +153,4 @@ Showable {
150 anchors.horizontalCenter: parent.horizontalCenter
153 anchors.horizontalCenter: parent.horizontalCenter
151 }
154 }
152 }
155 }
153−
154− Connections {
155− target: LightDM.Greeter
156−
157− onAuthenticationComplete: {
158− if (LightDM.Greeter.promptless) {
159− return;
160− }
161− if (LightDM.Greeter.authenticated) {
162− root.unlocked();
163− } else {
164− pinPadLoader.item.clear(true);
165− }
166− }
167− }
168}
156}
Greeter/PassphraseLockscreen.qml+1
@@ -82,6 +82,7 @@ Item {
82
82
83 WrongPasswordAnimation {
83 WrongPasswordAnimation {
84 id: wrongPasswordAnimation
84 id: wrongPasswordAnimation
85+ objectName: "wrongPasswordAnimation"
85 target: pinentryField
86 target: pinentryField
86 }
87 }
87}
88}
Greeter/PinLockscreen.qml+1
@@ -210,6 +210,7 @@ Column {
210
210
211 WrongPasswordAnimation {
211 WrongPasswordAnimation {
212 id: wrongPasswordAnimation
212 id: wrongPasswordAnimation
213+ objectName: "wrongPasswordAnimation"
213 target: pinentryField
214 target: pinentryField
214 }
215 }
215}
216}
Shell.qml+12−1
@@ -414,7 +414,7 @@ FocusScope {
414 height: parent.height - panel.panelHeight
414 height: parent.height - panel.panelHeight
415 background: shell.background
415 background: shell.background
416
416
417− onUnlocked: lockscreen.hide()
417+ onEntered: LightDM.Greeter.respond(passphrase);
418 onCancel: greeter.show()
418 onCancel: greeter.show()
419
419
420 Component.onCompleted: {
420 Component.onCompleted: {
@@ -440,6 +440,17 @@ FocusScope {
440 lockscreen.show();
440 lockscreen.show();
441 }
441 }
442 }
442 }
443+
444+ onAuthenticationComplete: {
445+ if (LightDM.Greeter.promptless) {
446+ return;
447+ }
448+ if (LightDM.Greeter.authenticated) {
449+ lockscreen.hide();
450+ } else {
451+ lockscreen.clear(true);
452+ }
453+ }
443 }
454 }
444
455
445 Greeter {
456 Greeter {
tests/qmltests/Greeter/tst_Lockscreen.qml+45−17
@@ -41,7 +41,7 @@ Rectangle {
41 target: lockscreen
41 target: lockscreen
42
42
43 onEmergencyCall: emergencyCheckBox.checked = true
43 onEmergencyCall: emergencyCheckBox.checked = true
44− onUnlocked: unlockedCheckBox.checked = true
44+ onEntered: enteredLabel.text = passphrase
45 }
45 }
46
46
47 Connections {
47 Connections {
@@ -99,12 +99,11 @@ Rectangle {
99 anchors.verticalCenter: parent.verticalCenter
99 anchors.verticalCenter: parent.verticalCenter
100 }
100 }
101 Row {
101 Row {
102− CheckBox {
102+ Label {
103− id: unlockedCheckBox
103+ text: "Entered:"
104 }
104 }
105 Label {
105 Label {
106− text: "Unlocked signal"
106+ id: enteredLabel
107− anchors.verticalCenter: parent.verticalCenter
108 }
107 }
109 }
108 }
110 Button {
109 Button {
@@ -176,16 +175,16 @@ Rectangle {
176
175
177 function test_unlock_data() {
176 function test_unlock_data() {
178 return [
177 return [
179− {tag: "numeric", alphanumeric: false, username: "has-pin", password: "1234", unlockedSignal: true, pinLength: 4},
178+ {tag: "numeric", alphanumeric: false, username: "has-pin", password: "1234", pinLength: 4},
180− {tag: "alphanumeric", alphanumeric: true, username: "has-password", password: "password", unlockedSignal: true, pinLength: -1},
179+ {tag: "alphanumeric", alphanumeric: true, username: "has-password", password: "password", pinLength: -1},
181− {tag: "numeric (wrong)", alphanumeric: false, username: "has-pin", password: "4321", unlockedSignal: false, pinLength: 4},
180+ {tag: "numeric (wrong)", alphanumeric: false, username: "has-pin", password: "4321", pinLength: 4},
182− {tag: "alphanumeric (wrong)", alphanumeric: true, username: "has-password", password: "drowssap", unlockedSignal: false, pinLength: -1},
181+ {tag: "alphanumeric (wrong)", alphanumeric: true, username: "has-password", password: "drowssap", pinLength: -1},
183− {tag: "flexible length", alphanumeric: false, username: "has-pin", password: "1234", unlockedSignal: true, pinLength: -1},
182+ {tag: "flexible length", alphanumeric: false, username: "has-pin", password: "1234", pinLength: -1},
184 ]
183 ]
185 }
184 }
186
185
187 function test_unlock(data) {
186 function test_unlock(data) {
188− unlockedCheckBox.checked = false
187+ enteredLabel.text = ""
189 pinLengthTextField.text = data.pinLength
188 pinLengthTextField.text = data.pinLength
190 LightDM.Greeter.authenticate(data.username)
189 LightDM.Greeter.authenticate(data.username)
191 waitForRendering(lockscreen)
190 waitForRendering(lockscreen)
@@ -206,14 +205,43 @@ Rectangle {
206 mouseClick(pinPadButtonErase, units.gu(1), units.gu(1));
205 mouseClick(pinPadButtonErase, units.gu(1), units.gu(1));
207 }
206 }
208 }
207 }
208+ tryCompare(enteredLabel, "text", data.password)
209+ }
210+
211+ function test_clear_data() {
212+ return [
213+ {tag: "animated PIN", animation: true, alphanumeric: false},
214+ {tag: "not animated PIN", animation: false, alphanumeric: false},
215+ {tag: "animated passphrase", animation: true, alphanumeric: true},
216+ {tag: "not animated passphrase", animation: false, alphanumeric: true}
217+ ];
218+ }
219+
220+ function test_clear(data) {
221+ pinPadCheckBox.checked = data.alphanumeric
222+ waitForRendering(lockscreen)
209
223
210− tryCompare(unlockedCheckBox, "checked", data.unlockedSignal)
224+ var inputField = findChild(lockscreen, "pinentryField")
211− if (!data.unlockedSignal) {
225+ if (data.alphanumeric) {
212− // make sure the input is cleared on wrong input
226+ mouseClick(inputField, units.gu(1), units.gu(1))
213− tryCompareFunction(function() {return inputField.text.length == 0}, true)
227+ typeString("1")
214 } else {
228 } else {
215− tryCompareFunction(function() {return inputField.text.length > 0}, true)
229+ var button = findChild(lockscreen, "pinPadButton1")
230+ mouseClick(button, units.gu(1), units.gu(1))
216 }
231 }
232+
233+ var animation = findInvisibleChild(lockscreen, "wrongPasswordAnimation")
234+
235+ tryCompare(inputField, "text", "1")
236+
237+ lockscreen.clear(data.animation)
238+ tryCompare(inputField, "text", "")
239+
240+ wait(0) // Trigger event loop to make sure the animation would start running
241+ compare(animation.running, data.animation)
242+
243+ // wait for animation to finish to not disturb other tests
244+ tryCompare(animation, "running", false)
217 }
245 }
218
246
219 function test_backspace_data() {
247 function test_backspace_data() {
@@ -224,7 +252,7 @@ Rectangle {
224 }
252 }
225
253
226 function test_backspace(data) {
254 function test_backspace(data) {
227− LightDM.Greeter.authenticate("has-pin");
255+ pinPadCheckBox.checked = false
228 pinLengthTextField.text = data.pinLength
256 pinLengthTextField.text = data.pinLength
229 waitForRendering(lockscreen);
257 waitForRendering(lockscreen);
230
258