42f94a
From 6a698c70044709e53f1a517165360037c070770d Mon Sep 17 00:00:00 2001
42f94a
From: Ray Strode <rstrode@redhat.com>
42f94a
Date: Wed, 30 Sep 2015 12:51:24 -0400
42f94a
Subject: [PATCH 1/3] authPrompt: don't fade out auth messages if user types
42f94a
 password up front
42f94a
42f94a
Right now we fade out any stale auth messages as soon as the user starts
42f94a
typing. This behavior doesn't really make sense if the user is typing up
42f94a
front, before a password is asked.
42f94a
---
42f94a
 js/gdm/authPrompt.js | 2 +-
42f94a
 1 file changed, 1 insertion(+), 1 deletion(-)
42f94a
42f94a
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
42f94a
index 481cd3a77..0ad3d2338 100644
42f94a
--- a/js/gdm/authPrompt.js
42f94a
+++ b/js/gdm/authPrompt.js
42f94a
@@ -176,7 +176,7 @@ var AuthPrompt = new Lang.Class({
42f94a
         this._updateNextButtonSensitivity(this._entry.text.length > 0);
42f94a
 
42f94a
         this._entry.clutter_text.connect('text-changed', () => {
42f94a
-            if (!this._userVerifier.hasPendingMessages)
42f94a
+            if (!this._userVerifier.hasPendingMessages && this._queryingService && !this._preemptiveAnswer)
42f94a
                 this._fadeOutMessage();
42f94a
 
42f94a
             this._updateNextButtonSensitivity(this._entry.text.length > 0 || this.verificationStatus == AuthPromptStatus.VERIFYING);
42f94a
-- 
42f94a
1.8.3.1
42f94a
42f94a
42f94a
From 867988ad707dfc7a7e2bae2ead774bc7369add8c Mon Sep 17 00:00:00 2001
42f94a
From: Ray Strode <rstrode@redhat.com>
42f94a
Date: Wed, 30 Sep 2015 14:36:33 -0400
42f94a
Subject: [PATCH 2/3] authPrompt: don't spin unless answering question
42f94a
42f94a
---
42f94a
 js/gdm/authPrompt.js | 2 +-
42f94a
 1 file changed, 1 insertion(+), 1 deletion(-)
42f94a
42f94a
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
42f94a
index 0ad3d2338..f18ef41f2 100644
42f94a
--- a/js/gdm/authPrompt.js
42f94a
+++ b/js/gdm/authPrompt.js
42f94a
@@ -66,8 +66,8 @@ var AuthPrompt = new Lang.Class({
42f94a
 
42f94a
         this.connect('next', () => {
42f94a
                 this.updateSensitivity(false);
42f94a
-                this.startSpinning();
42f94a
                 if (this._queryingService) {
42f94a
+                    this.startSpinning();
42f94a
                     this._userVerifier.answerQuery(this._queryingService, this._entry.text);
42f94a
                 } else {
42f94a
                     this._preemptiveAnswer = this._entry.text;
42f94a
-- 
42f94a
1.8.3.1
42f94a
42f94a
42f94a
From bcbb4c2044344a6ab4fda5975478b8bee07e01f5 Mon Sep 17 00:00:00 2001
42f94a
From: Ray Strode <rstrode@redhat.com>
42f94a
Date: Mon, 5 Oct 2015 15:26:18 -0400
42f94a
Subject: [PATCH 3/3] authPrompt: stop accepting preemptive answer if user
42f94a
 stops typing
42f94a
42f94a
We only want to allow the user to type the preemptive password in
42f94a
one smooth motion.  If they start to type, and then stop typing,
42f94a
we should discard their preemptive password as expired.
42f94a
42f94a
Typing ahead the password is just a convenience for users who don't
42f94a
want to manually lift the shift before typing their passwords, after
42f94a
all.
42f94a
---
42f94a
 js/gdm/authPrompt.js | 37 +++++++++++++++++++++++++++++++++++++
42f94a
 1 file changed, 37 insertions(+)
42f94a
42f94a
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
42f94a
index f18ef41f2..89cef4d5d 100644
42f94a
--- a/js/gdm/authPrompt.js
42f94a
+++ b/js/gdm/authPrompt.js
42f94a
@@ -10,6 +10,7 @@ const St = imports.gi.St;
42f94a
 const Animation = imports.ui.animation;
42f94a
 const Batch = imports.gdm.batch;
42f94a
 const GdmUtil = imports.gdm.util;
42f94a
+const Meta = imports.gi.Meta;
42f94a
 const Params = imports.misc.params;
42f94a
 const ShellEntry = imports.ui.shellEntry;
42f94a
 const Tweener = imports.ui.tweener;
42f94a
@@ -47,6 +48,8 @@ var AuthPrompt = new Lang.Class({
42f94a
         this._gdmClient = gdmClient;
42f94a
         this._mode = mode;
42f94a
 
42f94a
+        this._idleMonitor = Meta.IdleMonitor.get_core();
42f94a
+
42f94a
         let reauthenticationOnly;
42f94a
         if (this._mode == AuthPromptMode.UNLOCK_ONLY)
42f94a
             reauthenticationOnly = true;
42f94a
@@ -71,6 +74,11 @@ var AuthPrompt = new Lang.Class({
42f94a
                     this._userVerifier.answerQuery(this._queryingService, this._entry.text);
42f94a
                 } else {
42f94a
                     this._preemptiveAnswer = this._entry.text;
42f94a
+
42f94a
+                    if (this._preemptiveAnswerWatchId) {
42f94a
+                        this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId);
42f94a
+                        this._preemptiveAnswerWatchId = 0;
42f94a
+                    }
42f94a
                 }
42f94a
             });
42f94a
 
42f94a
@@ -135,6 +143,11 @@ var AuthPrompt = new Lang.Class({
42f94a
     },
42f94a
 
42f94a
     _onDestroy() {
42f94a
+        if (this._preemptiveAnswerWatchId) {
42f94a
+            this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId);
42f94a
+            this._preemptiveAnswerWatchId = 0;
42f94a
+        }
42f94a
+
42f94a
         this._userVerifier.destroy();
42f94a
         this._userVerifier = null;
42f94a
     },
42f94a
@@ -349,6 +362,11 @@ var AuthPrompt = new Lang.Class({
42f94a
     },
42f94a
 
42f94a
     setQuestion(question) {
42f94a
+        if (this._preemptiveAnswerWatchId) {
42f94a
+            this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId);
42f94a
+            this._preemptiveAnswerWatchId = 0;
42f94a
+        }
42f94a
+
42f94a
         this._label.set_text(question);
42f94a
 
42f94a
         this._label.show();
42f94a
@@ -434,12 +452,31 @@ var AuthPrompt = new Lang.Class({
42f94a
         }
42f94a
     },
42f94a
 
42f94a
+    _onUserStoppedTypePreemptiveAnswer() {
42f94a
+        if (!this._preemptiveAnswerWatchId ||
42f94a
+            this._preemptiveAnswer ||
42f94a
+            this._queryingService)
42f94a
+            return;
42f94a
+
42f94a
+        this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId);
42f94a
+        this._preemptiveAnswerWatchId = 0;
42f94a
+
42f94a
+        this._entry.text = '';
42f94a
+        this.updateSensitivity(false);
42f94a
+    },
42f94a
+
42f94a
     reset() {
42f94a
         let oldStatus = this.verificationStatus;
42f94a
         this.verificationStatus = AuthPromptStatus.NOT_VERIFYING;
42f94a
         this.cancelButton.reactive = true;
42f94a
         this.nextButton.label = _("Next");
42f94a
 
42f94a
+        if (this._preemptiveAnswerWatchId) {
42f94a
+            this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId);
42f94a
+        }
42f94a
+        this._preemptiveAnswerWatchId = this._idleMonitor.add_idle_watch (500,
42f94a
+                                                                          this._onUserStoppedTypePreemptiveAnswer.bind(this));
42f94a
+
42f94a
         if (this._userVerifier)
42f94a
             this._userVerifier.cancel();
42f94a
 
42f94a
-- 
42f94a
1.8.3.1
42f94a