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