[gnome-shell/wip/rstrode/fix-double-escape-at-unlock-screen: 14/14] unlockDialog: Properly reset auth prompt when showing it




commit e45d8817b4fc5fed35d3b39612f7993351b7c92c
Author: Ray Strode <rstrode redhat com>
Date:   Tue Oct 5 11:01:19 2021 -0400

    unlockDialog: Properly reset auth prompt when showing it
    
    If a user hits escape twice really fast when coming back to
    their machine to unlock it, they made end up getting presented
    with a non-functional unlock screen that doesn't show their
    user icon and doesn't ask for a password.
    
    This is because showPrompt assumes that if an auth prompt already
    exists, it's ready to go. That may not be true, if it's in the
    process of getting torn down at the time because it's in the middle
    of a cancel animation.
    
    This commit solves the problem by ensuring the auth prompt is always
    in a fresh reset state before showing it.

 js/ui/unlockDialog.js | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js
index f4c76c41ad..3e80c002a6 100644
--- a/js/ui/unlockDialog.js
+++ b/js/ui/unlockDialog.js
@@ -676,19 +676,19 @@ var UnlockDialog = GObject.registerClass({
     }
 
     _ensureAuthPrompt() {
-        if (this._authPrompt)
-            return;
-
-        this._authPrompt = new AuthPrompt.AuthPrompt(this._gdmClient,
-            AuthPrompt.AuthPromptMode.UNLOCK_ONLY);
-        this._authPrompt.connect('failed', this._fail.bind(this));
-        this._authPrompt.connect('cancelled', this._fail.bind(this));
-        this._authPrompt.connect('reset', this._onReset.bind(this));
-
-        this._promptBox.add_child(this._authPrompt);
+        if (!this._authPrompt) {
+            this._authPrompt = new AuthPrompt.AuthPrompt(this._gdmClient,
+                AuthPrompt.AuthPromptMode.UNLOCK_ONLY);
+            this._authPrompt.connect('failed', this._fail.bind(this));
+            this._authPrompt.connect('cancelled', this._fail.bind(this));
+            this._authPrompt.connect('reset', this._onReset.bind(this));
+            this._promptBox.add_child(this._authPrompt);
+        }
 
-        this._authPrompt.reset();
-        this._authPrompt.updateSensitivity(true);
+        if (this._authPrompt.verificationStatus !== AuthPromptStatus.NOT_VERIFYING) {
+            this._authPrompt.reset();
+            this._authPrompt.updateSensitivity(true);
+        }
     }
 
     _maybeDestroyAuthPrompt() {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]