on xenial help sign in
Show error msg and success bullets on lockscreen
commitb9e5bc712c2871340642c967c4cc6e2ac1436afc authorMichael Terry <michael.terry@canonical.com> dateWed 25 May 2016, 15:25 (10 years ago) parent3e52435
10 files changed+47−10
qml/Components/DelayedLockscreen.qml+1 qml/Components/Lockscreen.qml+8 qml/Components/PassphraseLockscreen.qml+4 qml/Components/PinLockscreen.qml+4 qml/Greeter/Greeter.qml+4−2 qml/Greeter/NarrowView.qml+14−2 qml/Greeter/WideView.qml+1−1 tests/qmltests/Greeter/TestView.qml+3−3 tests/qmltests/Greeter/tst_NarrowView.qml+7−1 tests/qmltests/Greeter/tst_WideView.qml+1−1
qml/Components/DelayedLockscreen.qml+1
@@ -28,6 +28,7 @@ Item {
2828 signal cancel() // unused
2929
3030 function clear(playAnimation) {}
31+ function showText(text) {}
3132
3233 Column {
3334 anchors.left: parent.left
qml/Components/Lockscreen.qml+8
@@ -91,6 +91,14 @@ Showable {
9191 popup.z = Number.MAX_VALUE
9292 }
9393
94+ function showText(text) {
95+ // Programmatically enters the given text into the lockscreen
96+ if (pinPadLoader.item) {
97+ pinPadLoader.waiting = true;
98+ pinPadLoader.item.showText(text);
99+ }
100+ }
101+
94102 Rectangle {
95103 // In case background fails to load
96104 id: backgroundBackup
qml/Components/PassphraseLockscreen.qml+4
@@ -43,6 +43,10 @@ FocusScope {
4343 }
4444 }
4545
46+ function showText(text) {
47+ pinentryField.text = text;
48+ }
49+
4650 Column {
4751 id: shakeContainer
4852 anchors.horizontalCenter: parent.horizontalCenter
qml/Components/PinLockscreen.qml+4
@@ -46,6 +46,10 @@ FocusScope {
4646 }
4747 }
4848
49+ function showText(text) {
50+ pinentryField.text = text;
51+ }
52+
4953 Keys.onPressed: {
5054 if (pinentryField.text.length == root.maxPinLength)
5155 return;
qml/Greeter/Greeter.qml+4−2
@@ -158,7 +158,7 @@ Showable {
158158 if (lightDM.greeter.startSessionSync()) {
159159 sessionStarted();
160160 if (loader.item) {
161− loader.item.notifyAuthenticationSucceeded();
161+ loader.item.notifyAuthenticationSucceeded(false /* showFakePassword */);
162162 }
163163 } else if (loader.item) {
164164 loader.item.notifyAuthenticationFailed();
@@ -177,7 +177,7 @@ Showable {
177177 function checkForcedUnlock() {
178178 if (forcedUnlock && shown && loader.item) {
179179 // pretend we were just authenticated
180− loader.item.notifyAuthenticationSucceeded();
180+ loader.item.notifyAuthenticationSucceeded(false /* showFakePassword */);
181181 loader.item.hide();
182182 }
183183 }
@@ -527,6 +527,8 @@ Showable {
527527 }
528528 console.log("Identified user by fingerprint:", result.uid);
529529 d.fingerprintFailureCount = 0;
530+ if (loader.item)
531+ loader.item.notifyAuthenticationSucceeded(true /* showFakePassword */);
530532 if (root.active)
531533 root.forcedUnlock = true;
532534 }
qml/Greeter/NarrowView.qml+14−2
@@ -65,19 +65,28 @@ FocusScope {
6565 coverPage.hide();
6666 }
6767
68− function notifyAuthenticationSucceeded() {
68+ function notifyAuthenticationSucceeded(showFakePassword) {
69+ // When using an alternate log in mechanism like fingerprints, the
70+ // design is it looks like the user entered a passcode.
71+ if (!alphanumeric && showFakePassword) {
72+ lockscreen.showText("...."); // actual text doesn't matter, we show bullets
73+ }
6974 lockscreen.hide();
7075 }
7176
7277 function notifyAuthenticationFailed() {
78+ lockscreen.customError = "";
7379 lockscreen.clear(true);
7480 }
7581
7682 function showErrorMessage(msg) {
7783 coverPage.showErrorMessage(msg);
84+ lockscreen.customError = msg;
85+ lockscreen.clear(true);
7886 }
7987
8088 function reset() {
89+ lockscreen.customError = "";
8190 coverPage.show();
8291 }
8392
@@ -120,7 +129,10 @@ FocusScope {
120129 infoText: promptText !== "" ? i18n.tr("Enter %1").arg(promptText) :
121130 alphaNumeric ? i18n.tr("Enter passphrase") :
122131 i18n.tr("Enter passcode")
123− errorText: promptText !== "" ? i18n.tr("Sorry, incorrect %1").arg(promptText) :
132+
133+ property string customError
134+ errorText: customError !== "" ? customError :
135+ promptText !== "" ? i18n.tr("Sorry, incorrect %1").arg(promptText) :
124136 alphaNumeric ? i18n.tr("Sorry, incorrect passphrase") + "\n" +
125137 i18n.ctr("passphrase", "Please re-enter") :
126138 i18n.tr("Sorry, incorrect passcode")
qml/Greeter/WideView.qml+1−1
@@ -58,7 +58,7 @@ FocusScope {
5858 coverPage.hide();
5959 }
6060
61− function notifyAuthenticationSucceeded() {
61+ function notifyAuthenticationSucceeded(showFakePassword) {
6262 // Nothing needed
6363 }
6464
tests/qmltests/Greeter/TestView.qml+3−3
@@ -48,7 +48,7 @@ Item {
4848 signal _showPromptCalled(string text, bool isSecret, bool isDefaultPrompt)
4949 signal _showLastChanceCalled()
5050 signal _hideCalled()
51− signal _notifyAuthenticationSucceededCalled()
51+ signal _notifyAuthenticationSucceededCalled(bool showFakePassword)
5252 signal _notifyAuthenticationFailedCalled()
5353 signal _showErrorMessageCalled(string msg)
5454 signal _resetCalled()
@@ -72,8 +72,8 @@ Item {
7272 _fullyShown = false;
7373 }
7474
75− function notifyAuthenticationSucceeded() {
76− _notifyAuthenticationSucceededCalled();
75+ function notifyAuthenticationSucceeded(showFakePassword) {
76+ _notifyAuthenticationSucceededCalled(showFakePassword);
7777 }
7878
7979 function notifyAuthenticationFailed() {
tests/qmltests/Greeter/tst_NarrowView.qml+7−1
@@ -128,7 +128,7 @@ Item {
128128 text: "Authenticated"
129129 onClicked: {
130130 if (successCheckBox.checked) {
131− loader.item.notifyAuthenticationSucceeded();
131+ loader.item.notifyAuthenticationSucceeded(fakePasswordCheckBox.checked);
132132 } else {
133133 loader.item.notifyAuthenticationFailed();
134134 }
@@ -140,6 +140,12 @@ Item {
140140 Label {
141141 text: "success"
142142 }
143+ CheckBox {
144+ id: fakePasswordCheckBox
145+ }
146+ Label {
147+ text: "fake password"
148+ }
143149 }
144150 Row {
145151 Button {
tests/qmltests/Greeter/tst_WideView.qml+1−1
@@ -168,7 +168,7 @@ Item {
168168 text: "Authenticated"
169169 onClicked: {
170170 if (successCheckBox.checked) {
171− loader.item.notifyAuthenticationSucceeded();
171+ loader.item.notifyAuthenticationSucceeded(false);
172172 } else {
173173 loader.item.notifyAuthenticationFailed();
174174 }