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