[gnome-shell/wip/smartcard: 5/16] authPrompt: consolidate verifyingUser/userVerified



commit c9e5b07888aca179608751639b8226e341e8d92a
Author: Ray Strode <rstrode redhat com>
Date:   Sun Jul 28 16:24:31 2013 -0400

    authPrompt: consolidate verifyingUser/userVerified
    
    Right now we have two booleans that specify when user verification
    is happening and when it succeeded, respectively.
    
    This commit consolidates them into one AuthPromptStatus enumeration.
    
    This clean up will allow us to check for verification failure more
    easily.

 js/gdm/authPrompt.js  |   22 ++++++++++++++--------
 js/gdm/loginDialog.js |    2 +-
 2 files changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
index f287b9e..e1a1c90 100644
--- a/js/gdm/authPrompt.js
+++ b/js/gdm/authPrompt.js
@@ -24,11 +24,18 @@ const AuthPromptMode = {
     UNLOCK_OR_LOG_IN: 1
 };
 
+const AuthPromptStatus = {
+    NOT_VERIFYING: 0,
+    VERIFYING: 1,
+    VERIFICATION_FAILED: 2,
+    VERIFICATION_SUCCEEDED: 3
+};
+
 const AuthPrompt = new Lang.Class({
     Name: 'AuthPrompt',
 
     _init: function(gdmClient, mode) {
-        this.verifyingUser = false;
+        this.verificationStatus = AuthPromptStatus.NOT_VERIFYING;
 
         this._gdmClient = gdmClient;
         this._mode = mode;
@@ -217,15 +224,15 @@ const AuthPrompt = new Lang.Class({
 
         this.updateSensitivity(true);
         this.setActorInDefaultButtonWell(null);
-        this.userVerified = false;
+        this.verificationStatus = AuthPromptStatus.VERIFICATION_FAILED;
     },
 
     _onVerificationComplete: function() {
-        this.userVerified = true;
+        this.verificationStatus = AuthPromptStatus.VERIFICATION_SUCCEEDED;
     },
 
     _onReset: function() {
-        if (!this.userVerified)
+        if (this.verificationStatus != AuthPromptStatus.VERIFICATION_SUCCEEDED)
             this.reset();
     },
 
@@ -398,8 +405,7 @@ const AuthPrompt = new Lang.Class({
     },
 
     reset: function() {
-        this.verifyingUser = false;
-        this.userVerified = false;
+        this.verificationStatus = AuthPromptStatus.NOT_VERIFYING;
         this._queryingService = null;
         this.clear();
         this._message.opacity = 0;
@@ -429,7 +435,7 @@ const AuthPrompt = new Lang.Class({
             hold = new Batch.Hold();
 
         this._userVerifier.begin(params.userName, hold);
-        this.verifyingUser = true;
+        this.verificationStatus = AuthPromptStatus.VERIFYING;
     },
 
     finish: function(onComplete) {
@@ -446,7 +452,7 @@ const AuthPrompt = new Lang.Class({
     },
 
     cancel: function() {
-        if (this.verifyingUser)
+        if (this.verificationStatus == AuthPromptStatus.VERIFYING)
             this._userVerifier.cancel();
 
         this.reset();
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
index 1978934..618c195 100644
--- a/js/gdm/loginDialog.js
+++ b/js/gdm/loginDialog.js
@@ -534,7 +534,7 @@ const LoginDialog = new Lang.Class({
         if (disableUserList != this._disableUserList) {
             this._disableUserList = disableUserList;
 
-            if (!this._authPrompt.verifyingUser)
+            if (this._authPrompt.verificationStatus == AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
                 this._authPrompt.reset();
         }
     },


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