on xenial help sign in
Show error msg and success bullets on lockscreen
b9e5bc7Michael Terry
qml/Components/DelayedLockscreen.qml+1
@@ -28,6 +28,7 @@ Item {
28 signal cancel() // unused
28 signal cancel() // unused
29
29
30 function clear(playAnimation) {}
30 function clear(playAnimation) {}
31+ function showText(text) {}
31
32
32 Column {
33 Column {
33 anchors.left: parent.left
34 anchors.left: parent.left
qml/Components/Lockscreen.qml+8
@@ -91,6 +91,14 @@ Showable {
91 popup.z = Number.MAX_VALUE
91 popup.z = Number.MAX_VALUE
92 }
92 }
93
93
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+
94 Rectangle {
102 Rectangle {
95 // In case background fails to load
103 // In case background fails to load
96 id: backgroundBackup
104 id: backgroundBackup
qml/Components/PassphraseLockscreen.qml+4
@@ -43,6 +43,10 @@ FocusScope {
43 }
43 }
44 }
44 }
45
45
46+ function showText(text) {
47+ pinentryField.text = text;
48+ }
49+
46 Column {
50 Column {
47 id: shakeContainer
51 id: shakeContainer
48 anchors.horizontalCenter: parent.horizontalCenter
52 anchors.horizontalCenter: parent.horizontalCenter
qml/Components/PinLockscreen.qml+4
@@ -46,6 +46,10 @@ FocusScope {
46 }
46 }
47 }
47 }
48
48
49+ function showText(text) {
50+ pinentryField.text = text;
51+ }
52+
49 Keys.onPressed: {
53 Keys.onPressed: {
50 if (pinentryField.text.length == root.maxPinLength)
54 if (pinentryField.text.length == root.maxPinLength)
51 return;
55 return;
qml/Greeter/Greeter.qml+4−2
@@ -158,7 +158,7 @@ Showable {
158 if (lightDM.greeter.startSessionSync()) {
158 if (lightDM.greeter.startSessionSync()) {
159 sessionStarted();
159 sessionStarted();
160 if (loader.item) {
160 if (loader.item) {
161− loader.item.notifyAuthenticationSucceeded();
161+ loader.item.notifyAuthenticationSucceeded(false /* showFakePassword */);
162 }
162 }
163 } else if (loader.item) {
163 } else if (loader.item) {
164 loader.item.notifyAuthenticationFailed();
164 loader.item.notifyAuthenticationFailed();
@@ -177,7 +177,7 @@ Showable {
177 function checkForcedUnlock() {
177 function checkForcedUnlock() {
178 if (forcedUnlock && shown && loader.item) {
178 if (forcedUnlock && shown && loader.item) {
179 // pretend we were just authenticated
179 // pretend we were just authenticated
180− loader.item.notifyAuthenticationSucceeded();
180+ loader.item.notifyAuthenticationSucceeded(false /* showFakePassword */);
181 loader.item.hide();
181 loader.item.hide();
182 }
182 }
183 }
183 }
@@ -527,6 +527,8 @@ Showable {
527 }
527 }
528 console.log("Identified user by fingerprint:", result.uid);
528 console.log("Identified user by fingerprint:", result.uid);
529 d.fingerprintFailureCount = 0;
529 d.fingerprintFailureCount = 0;
530+ if (loader.item)
531+ loader.item.notifyAuthenticationSucceeded(true /* showFakePassword */);
530 if (root.active)
532 if (root.active)
531 root.forcedUnlock = true;
533 root.forcedUnlock = true;
532 }
534 }
qml/Greeter/NarrowView.qml+14−2
@@ -65,19 +65,28 @@ FocusScope {
65 coverPage.hide();
65 coverPage.hide();
66 }
66 }
67
67
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+ }
69 lockscreen.hide();
74 lockscreen.hide();
70 }
75 }
71
76
72 function notifyAuthenticationFailed() {
77 function notifyAuthenticationFailed() {
78+ lockscreen.customError = "";
73 lockscreen.clear(true);
79 lockscreen.clear(true);
74 }
80 }
75
81
76 function showErrorMessage(msg) {
82 function showErrorMessage(msg) {
77 coverPage.showErrorMessage(msg);
83 coverPage.showErrorMessage(msg);
84+ lockscreen.customError = msg;
85+ lockscreen.clear(true);
78 }
86 }
79
87
80 function reset() {
88 function reset() {
89+ lockscreen.customError = "";
81 coverPage.show();
90 coverPage.show();
82 }
91 }
83
92
@@ -120,7 +129,10 @@ FocusScope {
120 infoText: promptText !== "" ? i18n.tr("Enter %1").arg(promptText) :
129 infoText: promptText !== "" ? i18n.tr("Enter %1").arg(promptText) :
121 alphaNumeric ? i18n.tr("Enter passphrase") :
130 alphaNumeric ? i18n.tr("Enter passphrase") :
122 i18n.tr("Enter passcode")
131 i18n.tr("Enter passcode")
132+
133+ property string customError
134+ errorText: customError !== "" ? customError :
123− errorText: promptText !== "" ? i18n.tr("Sorry, incorrect %1").arg(promptText) :
135+ promptText !== "" ? i18n.tr("Sorry, incorrect %1").arg(promptText) :
124 alphaNumeric ? i18n.tr("Sorry, incorrect passphrase") + "\n" +
136 alphaNumeric ? i18n.tr("Sorry, incorrect passphrase") + "\n" +
125 i18n.ctr("passphrase", "Please re-enter") :
137 i18n.ctr("passphrase", "Please re-enter") :
126 i18n.tr("Sorry, incorrect passcode")
138 i18n.tr("Sorry, incorrect passcode")
qml/Greeter/WideView.qml+1−1
@@ -58,7 +58,7 @@ FocusScope {
58 coverPage.hide();
58 coverPage.hide();
59 }
59 }
60
60
61− function notifyAuthenticationSucceeded() {
61+ function notifyAuthenticationSucceeded(showFakePassword) {
62 // Nothing needed
62 // Nothing needed
63 }
63 }
64
64
tests/qmltests/Greeter/TestView.qml+3−3
@@ -48,7 +48,7 @@ Item {
48 signal _showPromptCalled(string text, bool isSecret, bool isDefaultPrompt)
48 signal _showPromptCalled(string text, bool isSecret, bool isDefaultPrompt)
49 signal _showLastChanceCalled()
49 signal _showLastChanceCalled()
50 signal _hideCalled()
50 signal _hideCalled()
51− signal _notifyAuthenticationSucceededCalled()
51+ signal _notifyAuthenticationSucceededCalled(bool showFakePassword)
52 signal _notifyAuthenticationFailedCalled()
52 signal _notifyAuthenticationFailedCalled()
53 signal _showErrorMessageCalled(string msg)
53 signal _showErrorMessageCalled(string msg)
54 signal _resetCalled()
54 signal _resetCalled()
@@ -72,8 +72,8 @@ Item {
72 _fullyShown = false;
72 _fullyShown = false;
73 }
73 }
74
74
75− function notifyAuthenticationSucceeded() {
75+ function notifyAuthenticationSucceeded(showFakePassword) {
76− _notifyAuthenticationSucceededCalled();
76+ _notifyAuthenticationSucceededCalled(showFakePassword);
77 }
77 }
78
78
79 function notifyAuthenticationFailed() {
79 function notifyAuthenticationFailed() {
tests/qmltests/Greeter/tst_NarrowView.qml+7−1
@@ -128,7 +128,7 @@ Item {
128 text: "Authenticated"
128 text: "Authenticated"
129 onClicked: {
129 onClicked: {
130 if (successCheckBox.checked) {
130 if (successCheckBox.checked) {
131− loader.item.notifyAuthenticationSucceeded();
131+ loader.item.notifyAuthenticationSucceeded(fakePasswordCheckBox.checked);
132 } else {
132 } else {
133 loader.item.notifyAuthenticationFailed();
133 loader.item.notifyAuthenticationFailed();
134 }
134 }
@@ -140,6 +140,12 @@ Item {
140 Label {
140 Label {
141 text: "success"
141 text: "success"
142 }
142 }
143+ CheckBox {
144+ id: fakePasswordCheckBox
145+ }
146+ Label {
147+ text: "fake password"
148+ }
143 }
149 }
144 Row {
150 Row {
145 Button {
151 Button {
tests/qmltests/Greeter/tst_WideView.qml+1−1
@@ -168,7 +168,7 @@ Item {
168 text: "Authenticated"
168 text: "Authenticated"
169 onClicked: {
169 onClicked: {
170 if (successCheckBox.checked) {
170 if (successCheckBox.checked) {
171− loader.item.notifyAuthenticationSucceeded();
171+ loader.item.notifyAuthenticationSucceeded(false);
172 } else {
172 } else {
173 loader.item.notifyAuthenticationFailed();
173 loader.item.notifyAuthenticationFailed();
174 }
174 }