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
This commit is contained in:
@ -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();
|
||||
|
@ -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();
|
||||
}
|
||||
},
|
||||
|
Reference in New Issue
Block a user