From 84431cbc65b550a2444ebfee8fbf1e4519205009 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Fri, 7 Mar 2014 16:18:40 -0500 Subject: [PATCH] gdm: Move reset-on-smartcard / reset-on-ovirt code to ShellUserVerifier We still need to expose smartcardDetected to determine whether to prompt for a username. This part is another hairy mess of signals and layer violations that will need untangling, but we'll get there... --- js/gdm/authPrompt.js | 21 --------------------- js/gdm/util.js | 28 +++++++++++++++++++++++----- 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js index 1756a67a4..a0420a609 100644 --- a/js/gdm/authPrompt.js +++ b/js/gdm/authPrompt.js @@ -49,7 +49,6 @@ const AuthPrompt = new Lang.Class({ this._userVerifier.connect('verification-failed', Lang.bind(this, this._onVerificationFailed)); this._userVerifier.connect('reset', Lang.bind(this, this._onReset)); this._userVerifier.connect('smartcard-status-changed', Lang.bind(this, this._onSmartcardStatusChanged)); - this._userVerifier.connect('ovirt-user-authenticated', Lang.bind(this, this._onOVirtUserAuthenticated)); this.smartcardDetected = this._userVerifier.smartcardDetected; this.connect('next', Lang.bind(this, function() { @@ -215,28 +214,8 @@ const AuthPrompt = new Lang.Class({ this.emit('prompted'); }, - _onOVirtUserAuthenticated: function() { - if (this.verificationStatus != GdmUtil.VerificationStatus.VERIFICATION_SUCCEEDED) - this.reset(); - }, - _onSmartcardStatusChanged: function() { this.smartcardDetected = this._userVerifier.smartcardDetected; - - // Most of the time we want to reset if the user inserts or removes - // a smartcard. Smartcard insertion "preempts" what the user was - // doing, and smartcard removal aborts the preemption. - // The exceptions are: 1) Don't reset on smartcard insertion if we're already verifying - // with a smartcard - // 2) Don't reset if we've already succeeded at verification and - // the user is getting logged in. - if (this._userVerifier.serviceIsDefault(GdmUtil.SMARTCARD_SERVICE_NAME) && - this.verificationStatus == GdmUtil.VerificationStatus.VERIFYING && - this.smartcardDetected) - return; - - if (this.verificationStatus != GdmUtil.VerificationStatus.VERIFICATION_SUCCEEDED) - this.reset(); }, _onShowMessage: function(userVerifier, message, type) { diff --git a/js/gdm/util.js b/js/gdm/util.js index c0f4703c2..bd9cf3d79 100644 --- a/js/gdm/util.js +++ b/js/gdm/util.js @@ -306,7 +306,8 @@ const ShellUserVerifier = new Lang.Class({ }, _oVirtUserAuthenticated: function() { - this.emit('ovirt-user-authenticated'); + if (this.verificationStatus != GdmUtil.VerificationStatus.VERIFICATION_SUCCEEDED) + this._reset(); }, _checkForSmartcard: function() { @@ -319,10 +320,27 @@ const ShellUserVerifier = new Lang.Class({ else smartcardDetected = this._smartcardManager.hasInsertedTokens(); - if (smartcardDetected != this.smartcardDetected) { - this.smartcardDetected = smartcardDetected; - this.emit('smartcard-status-changed'); - } + if (this.smartcardDetected == smartcardDetected) + return; + + this.smartcardDetected = smartcardDetected; + + // Most of the time we want to reset if the user inserts or removes + // a smartcard. Smartcard insertion "preempts" what the user was + // doing, and smartcard removal aborts the preemption. + // The exceptions are: 1) Don't reset on smartcard insertion if we're already verifying + // with a smartcard + // 2) Don't reset if we've already succeeded at verification and + // the user is getting logged in. + if (this._serviceIsDefault(SMARTCARD_SERVICE_NAME) && + this.verificationStatus == VerificationStatus.VERIFYING && + this.smartcardDetected) + return; + + if (this.verificationStatus != VerificationStatus.VERIFICATION_SUCCEEDED) + this._reset(); + + this.emit('smartcard-status-changed'); }, _reportInitError: function(where, error) {