1bd53d
From 6739f213965c2b6a41c21b446095f393f9d86e43 Mon Sep 17 00:00:00 2001
1bd53d
From: Ray Strode <rstrode@redhat.com>
1bd53d
Date: Wed, 30 Sep 2015 12:51:24 -0400
1bd53d
Subject: [PATCH 1/3] authPrompt: don't fade out auth messages if user types
1bd53d
 password up front
1bd53d
1bd53d
Right now we fade out any stale auth messages as soon as the user starts
1bd53d
typing. This behavior doesn't really make sense if the user is typing up
1bd53d
front, before a password is asked.
1bd53d
---
1bd53d
 js/gdm/authPrompt.js | 2 +-
1bd53d
 1 file changed, 1 insertion(+), 1 deletion(-)
1bd53d
1bd53d
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
1bd53d
index 4844b9ee0..149e5ad4a 100644
1bd53d
--- a/js/gdm/authPrompt.js
1bd53d
+++ b/js/gdm/authPrompt.js
1bd53d
@@ -179,7 +179,7 @@ var AuthPrompt = GObject.registerClass({
1bd53d
 
1bd53d
         [this._textEntry, this._passwordEntry].forEach(entry => {
1bd53d
             entry.clutter_text.connect('text-changed', () => {
1bd53d
-                if (!this._userVerifier.hasPendingMessages)
1bd53d
+                if (!this._userVerifier.hasPendingMessages && this._queryingService && !this._preemptiveAnswer)
1bd53d
                     this._fadeOutMessage();
1bd53d
             });
1bd53d
 
1bd53d
-- 
1bd53d
2.31.1
1bd53d
1bd53d
1bd53d
From 2b84c3d611120ae2f60386d5c637b84d1958398d Mon Sep 17 00:00:00 2001
1bd53d
From: Ray Strode <rstrode@redhat.com>
1bd53d
Date: Wed, 30 Sep 2015 14:36:33 -0400
1bd53d
Subject: [PATCH 2/3] authPrompt: don't spin unless answering question
1bd53d
1bd53d
---
1bd53d
 js/gdm/authPrompt.js | 9 +++++----
1bd53d
 1 file changed, 5 insertions(+), 4 deletions(-)
1bd53d
1bd53d
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
1bd53d
index 149e5ad4a..c5643d046 100644
1bd53d
--- a/js/gdm/authPrompt.js
1bd53d
+++ b/js/gdm/authPrompt.js
1bd53d
@@ -243,13 +243,14 @@ var AuthPrompt = GObject.registerClass({
1bd53d
         this.verificationStatus = AuthPromptStatus.VERIFICATION_IN_PROGRESS;
1bd53d
         this.updateSensitivity(false);
1bd53d
 
1bd53d
-        if (shouldSpin)
1bd53d
-            this.startSpinning();
1bd53d
+        if (this._queryingService) {
1bd53d
+            if (shouldSpin)
1bd53d
+                this.startSpinning();
1bd53d
 
1bd53d
-        if (this._queryingService)
1bd53d
             this._userVerifier.answerQuery(this._queryingService, this._entry.text);
1bd53d
-        else
1bd53d
+        } else {
1bd53d
             this._preemptiveAnswer = this._entry.text;
1bd53d
+        }
1bd53d
 
1bd53d
         this.emit('next');
1bd53d
     }
1bd53d
-- 
1bd53d
2.31.1
1bd53d
1bd53d
1bd53d
From 56360c872e01b0554b4d8b53dddba5407d4e889b Mon Sep 17 00:00:00 2001
1bd53d
From: Ray Strode <rstrode@redhat.com>
1bd53d
Date: Mon, 5 Oct 2015 15:26:18 -0400
1bd53d
Subject: [PATCH 3/3] authPrompt: stop accepting preemptive answer if user
1bd53d
 stops typing
1bd53d
1bd53d
We only want to allow the user to type the preemptive password in
1bd53d
one smooth motion.  If they start to type, and then stop typing,
1bd53d
we should discard their preemptive password as expired.
1bd53d
1bd53d
Typing ahead the password is just a convenience for users who don't
1bd53d
want to manually lift the shift before typing their passwords, after
1bd53d
all.
1bd53d
---
1bd53d
 js/gdm/authPrompt.js | 37 ++++++++++++++++++++++++++++++++++++-
1bd53d
 1 file changed, 36 insertions(+), 1 deletion(-)
1bd53d
1bd53d
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
1bd53d
index c5643d046..84c608b2f 100644
1bd53d
--- a/js/gdm/authPrompt.js
1bd53d
+++ b/js/gdm/authPrompt.js
1bd53d
@@ -1,7 +1,7 @@
1bd53d
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
1bd53d
 /* exported AuthPrompt */
1bd53d
 
1bd53d
-const { Clutter, GLib, GObject, Pango, Shell, St } = imports.gi;
1bd53d
+const { Clutter, GLib, GObject, Meta, Pango, Shell, St } = imports.gi;
1bd53d
 
1bd53d
 const Animation = imports.ui.animation;
1bd53d
 const Batch = imports.gdm.batch;
1bd53d
@@ -63,6 +63,8 @@ var AuthPrompt = GObject.registerClass({
1bd53d
         this._defaultButtonWellActor = null;
1bd53d
         this._cancelledRetries = 0;
1bd53d
 
1bd53d
+        this._idleMonitor = Meta.IdleMonitor.get_core();
1bd53d
+
1bd53d
         let reauthenticationOnly;
1bd53d
         if (this._mode == AuthPromptMode.UNLOCK_ONLY)
1bd53d
             reauthenticationOnly = true;
1bd53d
@@ -119,6 +121,11 @@ var AuthPrompt = GObject.registerClass({
1bd53d
     }
1bd53d
 
1bd53d
     _onDestroy() {
1bd53d
+        if (this._preemptiveAnswerWatchId) {
1bd53d
+            this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId);
1bd53d
+            this._preemptiveAnswerWatchId = 0;
1bd53d
+        }
1bd53d
+
1bd53d
         this._userVerifier.destroy();
1bd53d
         this._userVerifier = null;
1bd53d
     }
1bd53d
@@ -250,6 +257,11 @@ var AuthPrompt = GObject.registerClass({
1bd53d
             this._userVerifier.answerQuery(this._queryingService, this._entry.text);
1bd53d
         } else {
1bd53d
             this._preemptiveAnswer = this._entry.text;
1bd53d
+
1bd53d
+            if (this._preemptiveAnswerWatchId) {
1bd53d
+                this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId);
1bd53d
+                this._preemptiveAnswerWatchId = 0;
1bd53d
+            }
1bd53d
         }
1bd53d
 
1bd53d
         this.emit('next');
1bd53d
@@ -429,6 +441,11 @@ var AuthPrompt = GObject.registerClass({
1bd53d
     }
1bd53d
 
1bd53d
     setQuestion(question) {
1bd53d
+        if (this._preemptiveAnswerWatchId) {
1bd53d
+            this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId);
1bd53d
+            this._preemptiveAnswerWatchId = 0;
1bd53d
+        }
1bd53d
+
1bd53d
         this._entry.hint_text = question;
1bd53d
 
1bd53d
         this._entry.show();
1bd53d
@@ -530,6 +547,19 @@ var AuthPrompt = GObject.registerClass({
1bd53d
             this._updateEntry(false);
1bd53d
     }
1bd53d
 
1bd53d
+    _onUserStoppedTypePreemptiveAnswer() {
1bd53d
+        if (!this._preemptiveAnswerWatchId ||
1bd53d
+            this._preemptiveAnswer ||
1bd53d
+            this._queryingService)
1bd53d
+            return;
1bd53d
+
1bd53d
+        this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId);
1bd53d
+        this._preemptiveAnswerWatchId = 0;
1bd53d
+
1bd53d
+        this._entry.text = '';
1bd53d
+        this.updateSensitivity(false);
1bd53d
+    }
1bd53d
+
1bd53d
     reset() {
1bd53d
         let oldStatus = this.verificationStatus;
1bd53d
         this.verificationStatus = AuthPromptStatus.NOT_VERIFYING;
1bd53d
@@ -537,6 +567,11 @@ var AuthPrompt = GObject.registerClass({
1bd53d
         this.cancelButton.can_focus = this._hasCancelButton;
1bd53d
         this._preemptiveAnswer = null;
1bd53d
 
1bd53d
+        if (this._preemptiveAnswerWatchId)
1bd53d
+            this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId);
1bd53d
+        this._preemptiveAnswerWatchId = this._idleMonitor.add_idle_watch(500,
1bd53d
+            this._onUserStoppedTypePreemptiveAnswer.bind(this));
1bd53d
+
1bd53d
         if (this._userVerifier)
1bd53d
             this._userVerifier.cancel();
1bd53d
 
1bd53d
-- 
1bd53d
2.31.1
1bd53d