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...
This commit is contained in:
Jasper St. Pierre 2014-03-07 16:18:40 -05:00
parent 92c283da4d
commit 84431cbc65
2 changed files with 23 additions and 26 deletions

View File

@ -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) {

View File

@ -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) {