Blame SOURCES/disallow-cancel-after-success.patch

13bb5b
From 6dd24af0a881aa7440f127036f42d8f521628c24 Mon Sep 17 00:00:00 2001
13bb5b
From: Ray Strode <rstrode@redhat.com>
13bb5b
Date: Sun, 5 Oct 2014 16:27:00 -0400
13bb5b
Subject: [PATCH] gdm: disallow cancel after verification succeeds
13bb5b
13bb5b
Once verification has succeeded, the train's already
13bb5b
left the building and we shouldn't allow canceling.
13bb5b
13bb5b
This commit renders the cancel button non-reactive
13bb5b
and makes the cancel function be a noop after
13bb5b
verification succeeds.
13bb5b
---
13bb5b
 js/gdm/authPrompt.js | 5 +++++
13bb5b
 1 file changed, 5 insertions(+)
13bb5b
13bb5b
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
13bb5b
index fd02c4d..d82b2b2 100644
13bb5b
--- a/js/gdm/authPrompt.js
13bb5b
+++ b/js/gdm/authPrompt.js
13bb5b
@@ -232,60 +232,61 @@ const AuthPrompt = new Lang.Class({
13bb5b
         // a smartcard. Smartcard insertion "preempts" what the user was
13bb5b
         // doing, and smartcard removal aborts the preemption.
13bb5b
         // The exceptions are: 1) Don't reset on smartcard insertion if we're already verifying
13bb5b
         //                        with a smartcard
13bb5b
         //                     2) Don't reset if we've already succeeded at verification and
13bb5b
         //                        the user is getting logged in.
13bb5b
         if (this._userVerifier.serviceIsDefault(GdmUtil.SMARTCARD_SERVICE_NAME) &&
13bb5b
             this.verificationStatus == AuthPromptStatus.VERIFYING &&
13bb5b
             this.smartcardDetected)
13bb5b
             return;
13bb5b
 
13bb5b
         if (this.verificationStatus != AuthPromptStatus.VERIFICATION_SUCCEEDED)
13bb5b
             this.reset();
13bb5b
     },
13bb5b
 
13bb5b
     _onShowMessage: function(userVerifier, message, type) {
13bb5b
         this.setMessage(message, type);
13bb5b
         this.emit('prompted');
13bb5b
     },
13bb5b
 
13bb5b
     _onVerificationFailed: function() {
13bb5b
         this.clear();
13bb5b
 
13bb5b
         this.updateSensitivity(true);
13bb5b
         this.setActorInDefaultButtonWell(null);
13bb5b
         this.verificationStatus = AuthPromptStatus.VERIFICATION_FAILED;
13bb5b
     },
13bb5b
 
13bb5b
     _onVerificationComplete: function() {
13bb5b
         this.verificationStatus = AuthPromptStatus.VERIFICATION_SUCCEEDED;
13bb5b
+	this.cancelButton.reactive = false;
13bb5b
     },
13bb5b
 
13bb5b
     _onReset: function() {
13bb5b
         if (this.verificationStatus != AuthPromptStatus.VERIFICATION_SUCCEEDED) {
13bb5b
             this.verificationStatus = AuthPromptStatus.NOT_VERIFYING;
13bb5b
             this.reset();
13bb5b
         }
13bb5b
     },
13bb5b
 
13bb5b
     addActorToDefaultButtonWell: function(actor) {
13bb5b
         this._defaultButtonWell.add_child(actor);
13bb5b
     },
13bb5b
 
13bb5b
     setActorInDefaultButtonWell: function(actor, animate) {
13bb5b
         if (!this._defaultButtonWellActor &&
13bb5b
             !actor)
13bb5b
             return;
13bb5b
 
13bb5b
         let oldActor = this._defaultButtonWellActor;
13bb5b
 
13bb5b
         if (oldActor)
13bb5b
             Tweener.removeTweens(oldActor);
13bb5b
 
13bb5b
         let isSpinner;
13bb5b
         if (actor == this._spinner.actor)
13bb5b
             isSpinner = true;
13bb5b
         else
13bb5b
             isSpinner = false;
13bb5b
 
13bb5b
         if (this._defaultButtonWellActor != actor && oldActor) {
13bb5b
@@ -403,60 +404,61 @@ const AuthPrompt = new Lang.Class({
13bb5b
 
13bb5b
     updateSensitivity: function(sensitive) {
13bb5b
         this._updateNextButtonSensitivity(sensitive);
13bb5b
         this._entry.reactive = sensitive;
13bb5b
         this._entry.clutter_text.editable = sensitive;
13bb5b
     },
13bb5b
 
13bb5b
     hide: function() {
13bb5b
         this.setActorInDefaultButtonWell(null, true);
13bb5b
         this.actor.hide();
13bb5b
         this._message.opacity = 0;
13bb5b
 
13bb5b
         this.setUser(null);
13bb5b
 
13bb5b
         this.updateSensitivity(true);
13bb5b
         this._entry.set_text('');
13bb5b
     },
13bb5b
 
13bb5b
     setUser: function(user) {
13bb5b
         if (user) {
13bb5b
             let userWidget = new UserWidget.UserWidget(user);
13bb5b
             this._userWell.set_child(userWidget.actor);
13bb5b
         } else {
13bb5b
             this._userWell.set_child(null);
13bb5b
         }
13bb5b
     },
13bb5b
 
13bb5b
     reset: function() {
13bb5b
         let oldStatus = this.verificationStatus;
13bb5b
         this.verificationStatus = AuthPromptStatus.NOT_VERIFYING;
13bb5b
+	this.cancelButton.reactive = true;
13bb5b
 
13bb5b
         if (oldStatus == AuthPromptStatus.VERIFYING)
13bb5b
             this._userVerifier.cancel();
13bb5b
 
13bb5b
         this._queryingService = null;
13bb5b
         this.clear();
13bb5b
         this._message.opacity = 0;
13bb5b
         this.setUser(null);
13bb5b
         this.stopSpinning();
13bb5b
 
13bb5b
         if (oldStatus == AuthPromptStatus.VERIFICATION_FAILED)
13bb5b
             this.emit('failed');
13bb5b
 
13bb5b
         let beginRequestType;
13bb5b
 
13bb5b
         if (this._mode == AuthPromptMode.UNLOCK_ONLY) {
13bb5b
             // The user is constant at the unlock screen, so it will immediately
13bb5b
             // respond to the request with the username
13bb5b
             beginRequestType = BeginRequestType.PROVIDE_USERNAME;
13bb5b
         } else if (this._userVerifier.serviceIsForeground(GdmUtil.OVIRT_SERVICE_NAME) ||
13bb5b
                    this._userVerifier.serviceIsForeground(GdmUtil.SMARTCARD_SERVICE_NAME)) {
13bb5b
             // We don't need to know the username if the user preempted the login screen
13bb5b
             // with a smartcard or with preauthenticated oVirt credentials
13bb5b
             beginRequestType = BeginRequestType.DONT_PROVIDE_USERNAME;
13bb5b
         } else {
13bb5b
             // In all other cases, we should get the username up front.
13bb5b
             beginRequestType = BeginRequestType.PROVIDE_USERNAME;
13bb5b
         }
13bb5b
 
13bb5b
         this.emit('reset', beginRequestType);
13bb5b
@@ -472,35 +474,38 @@ const AuthPrompt = new Lang.Class({
13bb5b
     },
13bb5b
 
13bb5b
     begin: function(params) {
13bb5b
         params = Params.parse(params, { userName: null,
13bb5b
                                         hold: null });
13bb5b
 
13bb5b
         this.updateSensitivity(false);
13bb5b
 
13bb5b
         let hold = params.hold;
13bb5b
         if (!hold)
13bb5b
             hold = new Batch.Hold();
13bb5b
 
13bb5b
         this._userVerifier.begin(params.userName, hold);
13bb5b
         this.verificationStatus = AuthPromptStatus.VERIFYING;
13bb5b
     },
13bb5b
 
13bb5b
     finish: function(onComplete) {
13bb5b
         if (!this._userVerifier.hasPendingMessages) {
13bb5b
             onComplete();
13bb5b
             return;
13bb5b
         }
13bb5b
 
13bb5b
         let signalId = this._userVerifier.connect('no-more-messages',
13bb5b
                                                   Lang.bind(this, function() {
13bb5b
                                                       this._userVerifier.disconnect(signalId);
13bb5b
                                                       onComplete();
13bb5b
                                                   }));
13bb5b
     },
13bb5b
 
13bb5b
     cancel: function() {
13bb5b
+        if (this.verificationStatus == AuthPromptStatus.NOT_VERIFYING || this.verificationStatus == AuthPromptStatus.VERIFICATION_SUCCEEDED) {
13bb5b
+            return;
13bb5b
+        }
13bb5b
         this.reset();
13bb5b
         this.emit('cancelled');
13bb5b
     }
13bb5b
 });
13bb5b
 Signals.addSignalMethods(AuthPrompt.prototype);
13bb5b
-- 
13bb5b
2.1.0
13bb5b