From 4d72bfd495ab0df6a8d97f23993198bbafcdbc78 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Sun, 28 Jul 2013 16:24:31 -0400 Subject: [PATCH] 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. https://bugzilla.gnome.org/show_bug.cgi?id=683437 --- 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 6b2480b1b..7bda7b5ac 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; @@ -222,15 +229,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(); }, @@ -403,8 +410,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; @@ -434,7 +440,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) { @@ -451,7 +457,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 40a4799db..9286f9857 100644 --- a/js/gdm/loginDialog.js +++ b/js/gdm/loginDialog.js @@ -529,7 +529,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(); } },