on xenial help sign in
Isolate calls to LightDM.Greeter.authenticate()
commit6a3d502f3986e359123a7c817a98c0d38231d767 authorMichael Terry <michael.terry@canonical.com> dateWed 3 Dec 2014, 10:31 (12 years ago) parente6a21a0
3 files changed+26−33
qml/Greeter/Greeter.qml+25−30 qml/Greeter/GreeterContent.qml−2 qml/Greeter/LoginList.qml+1−1
qml/Greeter/Greeter.qml+25−30
@@ -34,6 +34,7 @@ Showable {
3434 // 1 when fully shown and 0 when fully hidden
3535 readonly property real showProgress: MathUtils.clamp((width - Math.abs(greeterContentLoader.x)) / width, 0, 1)
3636 readonly property bool fullyShown: showProgress === 1 || lockscreen.shown
37+ readonly property bool semiShown: shown || lockscreen.shown
3738
3839 // True when the greeter is waiting for PAM or other setup process
3940 property bool waiting: true
@@ -52,8 +53,6 @@ Showable {
5253 readonly property bool narrowMode: !multiUser && !tabletMode
5354 readonly property bool multiUser: LightDM.Users.count > 1
5455
55− readonly property int currentIndex: greeterContentLoader.currentIndex
56−
5756 property real dragOffset
5857
5958 // We define a proxy and "is valid" property for launcherOffset because of
@@ -149,7 +148,7 @@ Showable {
149148 waiting = true;
150149
151150 if (narrowMode) {
152− LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
151+ d.selectUser(greeterContentLoader.currentIndex);
153152 } else {
154153 d.reset();
155154 }
@@ -188,6 +187,7 @@ Showable {
188187 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
189188 AccountsService.user = user;
190189 LauncherModel.setUser(user);
190+ LightDM.Greeter.authenticate(user); // always resets auth state
191191 }
192192
193193 function reset() {
@@ -264,12 +264,6 @@ Showable {
264264 }
265265 }
266266 }
267−
268− Component.onCompleted: {
269− if (greeter.narrowMode) {
270− LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
271− }
272− }
273267 }
274268
275269 Rectangle {
@@ -359,28 +353,29 @@ Showable {
359353 d.login();
360354 } else {
361355 AccountsService.failedLogins++
362− if (maxFailedLogins >= 2) { // require at least a warning
363− if (AccountsService.failedLogins === maxFailedLogins - 1) {
364− var title = lockscreen.alphaNumeric ?
365− i18n.tr("Sorry, incorrect passphrase.") :
366− i18n.tr("Sorry, incorrect passcode.")
367− var text = i18n.tr("This will be your last attempt.") + " " +
368− (lockscreen.alphaNumeric ?
369− i18n.tr("If passphrase is entered incorrectly, your phone will conduct a factory reset and all personal data will be deleted.") :
370− i18n.tr("If passcode is entered incorrectly, your phone will conduct a factory reset and all personal data will be deleted."))
371− lockscreen.showInfoPopup(title, text)
372− } else if (AccountsService.failedLogins >= maxFailedLogins) {
373− SystemImage.factoryReset() // Ouch!
374− }
375− }
376− if (failedLoginsDelayAttempts > 0 && AccountsService.failedLogins % failedLoginsDelayAttempts == 0) {
377− lockscreen.delayMinutes = failedLoginsDelayMinutes
378− forcedDelayTimer.start()
379− }
380356
381− lockscreen.clear(true);
382357 if (greeter.narrowMode) {
383− LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
358+ if (maxFailedLogins >= 2) { // require at least a warning
359+ if (AccountsService.failedLogins === maxFailedLogins - 1) {
360+ var title = lockscreen.alphaNumeric ?
361+ i18n.tr("Sorry, incorrect passphrase.") :
362+ i18n.tr("Sorry, incorrect passcode.")
363+ var text = i18n.tr("This will be your last attempt.") + " " +
364+ (lockscreen.alphaNumeric ?
365+ i18n.tr("If passphrase is entered incorrectly, your phone will conduct a factory reset and all personal data will be deleted.") :
366+ i18n.tr("If passcode is entered incorrectly, your phone will conduct a factory reset and all personal data will be deleted."))
367+ lockscreen.showInfoPopup(title, text)
368+ } else if (AccountsService.failedLogins >= maxFailedLogins) {
369+ SystemImage.factoryReset() // Ouch!
370+ }
371+ }
372+ if (failedLoginsDelayAttempts > 0 && AccountsService.failedLogins % failedLoginsDelayAttempts == 0) {
373+ lockscreen.delayMinutes = failedLoginsDelayMinutes
374+ forcedDelayTimer.start()
375+ }
376+
377+ lockscreen.clear(true);
378+ d.selectUser(greeterContentLoader.currentIndex);
384379 }
385380 }
386381 }
@@ -389,6 +384,6 @@ Showable {
389384 Binding {
390385 target: LightDM.Greeter
391386 property: "active"
392− value: greeter.fullyShown || greeter.hasLockedApp
387+ value: greeter.semiShown || greeter.hasLockedApp
393388 }
394389}
qml/Greeter/GreeterContent.qml−2
@@ -255,7 +255,6 @@ Item {
255255 anchors.left: parent.right
256256 anchors.top: parent.top
257257 anchors.bottom: parent.bottom
258− visible: parent.required
259258 fillMode: Image.Tile
260259 source: "../graphics/dropshadow_right.png"
261260 }
@@ -265,7 +264,6 @@ Item {
265264 anchors.right: parent.left
266265 anchors.top: parent.top
267266 anchors.bottom: parent.bottom
268− visible: parent.required
269267 fillMode: Image.Tile
270268 source: "../graphics/dropshadow_left.png"
271269 }
qml/Greeter/LoginList.qml+1−1
@@ -261,7 +261,7 @@ Item {
261261 passwordInput.focus = false;
262262 passwordInput.enabled = true;
263263 root.wasPrompted = false;
264− LightDM.Greeter.authenticate(userList.model.data(currentIndex, LightDM.UserRoles.NameRole));
264+ selected(currentIndex);
265265 }
266266
267267 Connections {