671c89
From a57132816ac7bd93d6875fee0a6c5b273177ac8d Mon Sep 17 00:00:00 2001
671c89
From: Ray Strode <rstrode@redhat.com>
671c89
Date: Wed, 30 Sep 2015 12:51:24 -0400
671c89
Subject: [PATCH 1/3] authPrompt: don't fade out auth messages if user types
671c89
 password up front
671c89
671c89
Right now we fade out any stale auth messages as soon as the user starts
671c89
typing. This behavior doesn't really make sense if the user is typing up
671c89
front, before a password is asked.
671c89
---
671c89
 js/gdm/authPrompt.js | 2 +-
671c89
 1 file changed, 1 insertion(+), 1 deletion(-)
671c89
671c89
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
671c89
index d7f53a92e..d421a8856 100644
671c89
--- a/js/gdm/authPrompt.js
671c89
+++ b/js/gdm/authPrompt.js
671c89
@@ -169,7 +169,7 @@ var AuthPrompt = class {
671c89
         this._updateNextButtonSensitivity(this._entry.text.length > 0);
671c89
 
671c89
         this._entry.clutter_text.connect('text-changed', () => {
671c89
-            if (!this._userVerifier.hasPendingMessages)
671c89
+            if (!this._userVerifier.hasPendingMessages && this._queryingService && !this._preemptiveAnswer)
671c89
                 this._fadeOutMessage();
671c89
 
671c89
             this._updateNextButtonSensitivity(this._entry.text.length > 0 || this.verificationStatus == AuthPromptStatus.VERIFYING);
671c89
-- 
671c89
2.21.0
671c89
671c89
671c89
From 50af703ea95f2b73733c38e66c9c251663a51744 Mon Sep 17 00:00:00 2001
671c89
From: Ray Strode <rstrode@redhat.com>
671c89
Date: Wed, 30 Sep 2015 14:36:33 -0400
671c89
Subject: [PATCH 2/3] authPrompt: don't spin unless answering question
671c89
671c89
---
671c89
 js/gdm/authPrompt.js | 2 +-
671c89
 1 file changed, 1 insertion(+), 1 deletion(-)
671c89
671c89
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
671c89
index d421a8856..62c5bd078 100644
671c89
--- a/js/gdm/authPrompt.js
671c89
+++ b/js/gdm/authPrompt.js
671c89
@@ -60,8 +60,8 @@ var AuthPrompt = class {
671c89
 
671c89
         this.connect('next', () => {
671c89
                 this.updateSensitivity(false);
671c89
-                this.startSpinning();
671c89
                 if (this._queryingService) {
671c89
+                    this.startSpinning();
671c89
                     this._userVerifier.answerQuery(this._queryingService, this._entry.text);
671c89
                 } else {
671c89
                     this._preemptiveAnswer = this._entry.text;
671c89
-- 
671c89
2.21.0
671c89
671c89
671c89
From b89be880936ad9dd145eb43890ac72d03c37785d Mon Sep 17 00:00:00 2001
671c89
From: Ray Strode <rstrode@redhat.com>
671c89
Date: Mon, 5 Oct 2015 15:26:18 -0400
671c89
Subject: [PATCH 3/3] authPrompt: stop accepting preemptive answer if user
671c89
 stops typing
671c89
671c89
We only want to allow the user to type the preemptive password in
671c89
one smooth motion.  If they start to type, and then stop typing,
671c89
we should discard their preemptive password as expired.
671c89
671c89
Typing ahead the password is just a convenience for users who don't
671c89
want to manually lift the shift before typing their passwords, after
671c89
all.
671c89
---
671c89
 js/gdm/authPrompt.js | 37 +++++++++++++++++++++++++++++++++++++
671c89
 1 file changed, 37 insertions(+)
671c89
671c89
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
671c89
index 62c5bd078..27eb31a89 100644
671c89
--- a/js/gdm/authPrompt.js
671c89
+++ b/js/gdm/authPrompt.js
671c89
@@ -6,6 +6,7 @@ const Signals = imports.signals;
671c89
 const Animation = imports.ui.animation;
671c89
 const Batch = imports.gdm.batch;
671c89
 const GdmUtil = imports.gdm.util;
671c89
+const Meta = imports.gi.Meta;
671c89
 const Params = imports.misc.params;
671c89
 const ShellEntry = imports.ui.shellEntry;
671c89
 const Tweener = imports.ui.tweener;
671c89
@@ -41,6 +42,8 @@ var AuthPrompt = class {
671c89
         this._gdmClient = gdmClient;
671c89
         this._mode = mode;
671c89
 
671c89
+        this._idleMonitor = Meta.IdleMonitor.get_core();
671c89
+
671c89
         let reauthenticationOnly;
671c89
         if (this._mode == AuthPromptMode.UNLOCK_ONLY)
671c89
             reauthenticationOnly = true;
671c89
@@ -65,6 +68,11 @@ var AuthPrompt = class {
671c89
                     this._userVerifier.answerQuery(this._queryingService, this._entry.text);
671c89
                 } else {
671c89
                     this._preemptiveAnswer = this._entry.text;
671c89
+
671c89
+                    if (this._preemptiveAnswerWatchId) {
671c89
+                        this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId);
671c89
+                        this._preemptiveAnswerWatchId = 0;
671c89
+                    }
671c89
                 }
671c89
             });
671c89
 
671c89
@@ -128,6 +136,11 @@ var AuthPrompt = class {
671c89
     }
671c89
 
671c89
     _onDestroy() {
671c89
+        if (this._preemptiveAnswerWatchId) {
671c89
+            this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId);
671c89
+            this._preemptiveAnswerWatchId = 0;
671c89
+        }
671c89
+
671c89
         this._userVerifier.destroy();
671c89
         this._userVerifier = null;
671c89
     }
671c89
@@ -342,6 +355,11 @@ var AuthPrompt = class {
671c89
     }
671c89
 
671c89
     setQuestion(question) {
671c89
+        if (this._preemptiveAnswerWatchId) {
671c89
+            this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId);
671c89
+            this._preemptiveAnswerWatchId = 0;
671c89
+        }
671c89
+
671c89
         this._label.set_text(question);
671c89
 
671c89
         this._label.show();
671c89
@@ -427,6 +445,19 @@ var AuthPrompt = class {
671c89
         }
671c89
     }
671c89
 
671c89
+    _onUserStoppedTypePreemptiveAnswer() {
671c89
+        if (!this._preemptiveAnswerWatchId ||
671c89
+            this._preemptiveAnswer ||
671c89
+            this._queryingService)
671c89
+            return;
671c89
+
671c89
+        this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId);
671c89
+        this._preemptiveAnswerWatchId = 0;
671c89
+
671c89
+        this._entry.text = '';
671c89
+        this.updateSensitivity(false);
671c89
+    }
671c89
+
671c89
     reset() {
671c89
         let oldStatus = this.verificationStatus;
671c89
         this.verificationStatus = AuthPromptStatus.NOT_VERIFYING;
671c89
@@ -434,6 +465,12 @@ var AuthPrompt = class {
671c89
         this.nextButton.label = _("Next");
671c89
         this._preemptiveAnswer = null;
671c89
 
671c89
+        if (this._preemptiveAnswerWatchId) {
671c89
+            this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId);
671c89
+        }
671c89
+        this._preemptiveAnswerWatchId = this._idleMonitor.add_idle_watch (500,
671c89
+                                                                          this._onUserStoppedTypePreemptiveAnswer.bind(this));
671c89
+
671c89
         if (this._userVerifier)
671c89
             this._userVerifier.cancel();
671c89
 
671c89
-- 
671c89
2.21.0
671c89