@@ -16,7 +16,7 @@
1616
1717import QtQuick 2.4
1818import AccountsService 0.1
19−import Biometryd 0.0 as Biometryd
19+import Biometryd 0.0
2020import GSettings 1.0
2121import Ubuntu.Components 1.3
2222import Ubuntu.SystemImage 0.1
@@ -482,35 +482,43 @@ Showable {
482482 onLanguageChanged: lightDM.infographic.readyForDataChange()
483483 }
484484
485− Biometryd.Observer {
485+ Observer {
486486 id: biometryd
487487 objectName: "biometryd"
488488
489− property var operation
489+ property var operation: null
490490
491− Component.onCompleted: {
492− if (Biometryd.defaultDevice) {
491+ function cancelOperation() {
492+ if (operation) {
493+ operation.cancel();
494+ operation = null;
495+ }
496+ }
497+
498+ function restartOperation() {
499+ cancelOperation();
500+
501+ if (Biometryd.defaultDevice && true /* FIXME check AS */) {
493502 var identifier = Biometryd.defaultDevice.identifier;
494503 operation = identifier.identifyUser();
495504 operation.start(biometryd);
496505 }
497506 }
498507
499− Component.onDestruction: {
500− if (operation)
501− operation.cancel();
502− }
508+ Component.onCompleted: restartOperation()
509+ Component.onDestruction: cancelOperation()
503510
504511 onSucceeded: {
505512 // FIXME validate result.uid
506513 d.fingerprintFailureCount = 0;
507− operation.start(biometryd);
514+ restartOperation();
508515 if (root.active)
509516 root.forcedUnlock = true;
510517 }
511518 onFailed: {
519+ console.log("Failed to identify user:", reason);
512520 d.fingerprintFailureCount++;
513− operation.start(biometryd);
521+ restartOperation();
514522 if (loader.item)
515523 loader.item.showErrorMessage(i18n.tr("Try again"));
516524 }