on xenial help sign in
Isolate calls to LightDM.Greeter.authenticate()
6a3d502Michael Terry
qml/Greeter/Greeter.qml+25−30
@@ -34,6 +34,7 @@ Showable {
34 // 1 when fully shown and 0 when fully hidden
34 // 1 when fully shown and 0 when fully hidden
35 readonly property real showProgress: MathUtils.clamp((width - Math.abs(greeterContentLoader.x)) / width, 0, 1)
35 readonly property real showProgress: MathUtils.clamp((width - Math.abs(greeterContentLoader.x)) / width, 0, 1)
36 readonly property bool fullyShown: showProgress === 1 || lockscreen.shown
36 readonly property bool fullyShown: showProgress === 1 || lockscreen.shown
37+ readonly property bool semiShown: shown || lockscreen.shown
37
38
38 // True when the greeter is waiting for PAM or other setup process
39 // True when the greeter is waiting for PAM or other setup process
39 property bool waiting: true
40 property bool waiting: true
@@ -52,8 +53,6 @@ Showable {
52 readonly property bool narrowMode: !multiUser && !tabletMode
53 readonly property bool narrowMode: !multiUser && !tabletMode
53 readonly property bool multiUser: LightDM.Users.count > 1
54 readonly property bool multiUser: LightDM.Users.count > 1
54
55
55− readonly property int currentIndex: greeterContentLoader.currentIndex
56−
57 property real dragOffset
56 property real dragOffset
58
57
59 // We define a proxy and "is valid" property for launcherOffset because of
58 // We define a proxy and "is valid" property for launcherOffset because of
@@ -149,7 +148,7 @@ Showable {
149 waiting = true;
148 waiting = true;
150
149
151 if (narrowMode) {
150 if (narrowMode) {
152− LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
151+ d.selectUser(greeterContentLoader.currentIndex);
153 } else {
152 } else {
154 d.reset();
153 d.reset();
155 }
154 }
@@ -188,6 +187,7 @@ Showable {
188 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
187 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
189 AccountsService.user = user;
188 AccountsService.user = user;
190 LauncherModel.setUser(user);
189 LauncherModel.setUser(user);
190+ LightDM.Greeter.authenticate(user); // always resets auth state
191 }
191 }
192
192
193 function reset() {
193 function reset() {
@@ -264,12 +264,6 @@ Showable {
264 }
264 }
265 }
265 }
266 }
266 }
267−
268− Component.onCompleted: {
269− if (greeter.narrowMode) {
270− LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
271− }
272− }
273 }
267 }
274
268
275 Rectangle {
269 Rectangle {
@@ -359,28 +353,29 @@ Showable {
359 d.login();
353 d.login();
360 } else {
354 } else {
361 AccountsService.failedLogins++
355 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− }
380
356
381− lockscreen.clear(true);
382 if (greeter.narrowMode) {
357 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);
384 }
379 }
385 }
380 }
386 }
381 }
@@ -389,6 +384,6 @@ Showable {
389 Binding {
384 Binding {
390 target: LightDM.Greeter
385 target: LightDM.Greeter
391 property: "active"
386 property: "active"
392− value: greeter.fullyShown || greeter.hasLockedApp
387+ value: greeter.semiShown || greeter.hasLockedApp
393 }
388 }
394}
389}
qml/Greeter/GreeterContent.qml−2
@@ -255,7 +255,6 @@ Item {
255 anchors.left: parent.right
255 anchors.left: parent.right
256 anchors.top: parent.top
256 anchors.top: parent.top
257 anchors.bottom: parent.bottom
257 anchors.bottom: parent.bottom
258− visible: parent.required
259 fillMode: Image.Tile
258 fillMode: Image.Tile
260 source: "../graphics/dropshadow_right.png"
259 source: "../graphics/dropshadow_right.png"
261 }
260 }
@@ -265,7 +264,6 @@ Item {
265 anchors.right: parent.left
264 anchors.right: parent.left
266 anchors.top: parent.top
265 anchors.top: parent.top
267 anchors.bottom: parent.bottom
266 anchors.bottom: parent.bottom
268− visible: parent.required
269 fillMode: Image.Tile
267 fillMode: Image.Tile
270 source: "../graphics/dropshadow_left.png"
268 source: "../graphics/dropshadow_left.png"
271 }
269 }
qml/Greeter/LoginList.qml+1−1
@@ -261,7 +261,7 @@ Item {
261 passwordInput.focus = false;
261 passwordInput.focus = false;
262 passwordInput.enabled = true;
262 passwordInput.enabled = true;
263 root.wasPrompted = false;
263 root.wasPrompted = false;
264− LightDM.Greeter.authenticate(userList.model.data(currentIndex, LightDM.UserRoles.NameRole));
264+ selected(currentIndex);
265 }
265 }
266
266
267 Connections {
267 Connections {