on xenial help sign in
Show correct placeholder text, add wrong-password placeholder text, and keep it showing until next entry
commited919eb7c23099a9b20682bdb4709db82219ec56 authorMichael Terry <michael.terry@canonical.com> dateThu 31 Jul 2014, 14:07 (12 years ago) parent450393f
2 files changed+20−6
qml/Components/PinLockscreen.qml+3−1 qml/Shell.qml+17−5
qml/Components/PinLockscreen.qml+3−1
@@ -38,6 +38,7 @@ Column {
3838
3939 function clear(playAnimation) {
4040 pinentryField.text = "";
41+ pinentryFieldPlaceHolder.text = playAnimation ? wrongPlaceholderText : placeholderText
4142 if (playAnimation) {
4243 wrongPasswordAnimation.start();
4344 }
@@ -90,9 +91,10 @@ Column {
9091 id: pinentryFieldPlaceHolder
9192 objectName: "pinentryFieldPlaceHolder"
9293 anchors.centerIn: parent
94+ horizontalAlignment: Text.AlignHCenter
9395 color: "#f3f3e7"
9496 opacity: 0.6
95− text: wrongPasswordAnimation.running ? parent.wrongPlaceholderText : parent.placeholderText
97+ text: parent.placeholderText
9698 visible: pinentryFieldLabel.text.length == 0
9799 }
98100
qml/Shell.qml+17−5
@@ -387,7 +387,15 @@ Item {
387387
388388 onShowPrompt: {
389389 if (greeter.narrowMode) {
390− lockscreen.placeholderText = i18n.tr("Please enter %1").arg(text.toLowerCase());
390+ var promptText = text.toLowerCase()
391+ if (promptText === "password") {
392+ promptText = lockscreen.alphaNumeric ?
393+ i18n.tr("passphrase") : i18n.tr("passcode")
394+ }
395+ lockscreen.placeholderText = i18n.tr("Enter your %1").arg(promptText)
396+ lockscreen.wrongPlaceholderText = i18n.tr("Incorrect %1").arg(promptText) +
397+ "\n" +
398+ i18n.tr("Please re-enter")
391399 lockscreen.show();
392400 }
393401 }
@@ -460,6 +468,14 @@ Item {
460468 }
461469
462470 property bool fullyShown: showProgress === 1.0
471+ onFullyShownChanged: {
472+ // Wait until the greeter is completely covering lockscreen before resetting it.
473+ if (fullyShown && !LightDM.Greeter.authenticated) {
474+ lockscreen.reset();
475+ lockscreen.show();
476+ }
477+ }
478+
463479 readonly property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
464480 onShowProgressChanged: if (LightDM.Greeter.authenticated && showProgress === 0) greeter.login()
465481
@@ -498,10 +514,6 @@ Item {
498514 if (greeter.narrowMode) {
499515 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
500516 }
501− if (!LightDM.Greeter.authenticated) {
502− lockscreen.reset();
503− lockscreen.show();
504− }
505517 greeter.fakeActiveForApp = "";
506518 greeter.forceActiveFocus();
507519 }