@@ -114,7 +114,8 @@ Showable {
114114 id: d
115115
116116 readonly property bool multiUser: LightDMService.users.count > 1
117− property int currentIndex
117+ readonly property int selectUserIndex: d.getUserIndex(LightDMService.greeter.selectUser)
118+ property int currentIndex: Math.max(selectUserIndex, 0)
118119 property bool waiting
119120
120121 // We want 'launcherOffset' to animate down to zero. But not to animate
@@ -131,7 +132,19 @@ Showable {
131132 UbuntuNumberAnimation {}
132133 }
133134
135+ function getUserIndex(username) {
136+ // Find index for requested user, if it exists
137+ for (var i = 0; i < LightDMService.users.count; i++) {
138+ if (username === LightDMService.users.data(i, LightDMService.userRoles.NameRole)) {
139+ return i;
140+ }
141+ }
142+ return -1;
143+ }
144+
134145 function selectUser(uid, reset) {
146+ if (uid < 0)
147+ return;
135148 d.waiting = true;
136149 if (reset) {
137150 loader.item.reset();
@@ -440,15 +453,7 @@ Showable {
440453 }
441454 }
442455
443− onRequestAuthenticationUser: {
444− // Find index for requested user, if it exists
445− for (var i = 0; i < LightDMService.users.count; i++) {
446− if (user === LightDMService.users.data(i, LightDMService.userRoles.NameRole)) {
447− d.selectUser(i, true);
448− return;
449− }
450− }
451− }
456+ onRequestAuthenticationUser: d.selectUser(d.getUserIndex(user), true)
452457 }
453458
454459 Connections {