Blame SOURCES/disable-unlock-entry-until-question.patch

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