Blob Blame History Raw
From 497fa4820897bf6579cfc11b33b383a36faca408 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Wed, 14 Jun 2017 10:05:36 -0400
Subject: [PATCH] authPrompt: allow empty response to PAM messages

Some PAM modules say "Press enter to continue" or
whatever.  We need to support them.

This commit allows empty responses to PAM questions,
but still requires a non-empty response for username.
---
 js/gdm/authPrompt.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
index ae03a5b49..a18615059 100644
--- a/js/gdm/authPrompt.js
+++ b/js/gdm/authPrompt.js
@@ -213,61 +213,61 @@ const AuthPrompt = new Lang.Class({
         this._buttonBox.add(this._defaultButtonWell,
                             { expand: true,
                               x_fill: false,
                               y_fill: false,
                               x_align: St.Align.END,
                               y_align: St.Align.MIDDLE });
         this.nextButton = new St.Button({ style_class: 'modal-dialog-button button',
                                           button_mask: St.ButtonMask.ONE | St.ButtonMask.THREE,
                                           reactive: true,
                                           can_focus: true,
                                           label: _("Next") });
         this.nextButton.connect('clicked',
                                  Lang.bind(this, function() {
                                      this.emit('next');
                                  }));
         this.nextButton.add_style_pseudo_class('default');
         this._buttonBox.add(this.nextButton,
                             { expand: false,
                               x_fill: false,
                               y_fill: false,
                               x_align: St.Align.END,
                               y_align: St.Align.END });
 
         this._updateNextButtonSensitivity(this._entry.text.length > 0);
 
         this._entry.clutter_text.connect('text-changed',
                                          Lang.bind(this, function() {
                                              if (!this._userVerifier.hasPendingMessages && this._queryingService && !this._preemptiveAnswer)
                                                  this._fadeOutMessage();
 
-                                             this._updateNextButtonSensitivity(this._entry.text.length > 0);
+                                             this._updateNextButtonSensitivity(this._entry.text.length > 0 || this.verificationStatus == AuthPromptStatus.VERIFYING);
                                          }));
         this._entry.clutter_text.connect('activate', Lang.bind(this, function() {
             if (this.nextButton.reactive)
                 this.emit('next');
         }));
     },
 
     _onAskQuestion: function(verifier, serviceName, question, passwordChar) {
         if (this._queryingService)
             this.clear();
 
         this._queryingService = serviceName;
         if (this._preemptiveAnswer) {
             this._userVerifier.answerQuery(this._queryingService, this._preemptiveAnswer);
             this._preemptiveAnswer = null;
             return;
         }
         this.setPasswordChar(passwordChar);
         this.setQuestion(question);
 
         if (passwordChar) {
             if (this._userVerifier.reauthenticating)
                 this.nextButton.label = _("Unlock");
             else
                 this.nextButton.label = C_("button", "Sign In");
         } else {
             this.nextButton.label = _("Next");
         }
 
         this.updateSensitivity(true);
@@ -446,61 +446,61 @@ const AuthPrompt = new Lang.Class({
                            transition: 'easeOutQuad'
                          });
     },
 
     setMessage: function(message, type) {
         if (type == GdmUtil.MessageType.ERROR)
             this._message.add_style_class_name('login-dialog-message-warning');
         else
             this._message.remove_style_class_name('login-dialog-message-warning');
 
         if (type == GdmUtil.MessageType.HINT)
             this._message.add_style_class_name('login-dialog-message-hint');
         else
             this._message.remove_style_class_name('login-dialog-message-hint');
 
         if (message) {
             Tweener.removeTweens(this._message);
             this._message.text = message;
             this._message.opacity = 255;
         } else {
             this._message.opacity = 0;
         }
     },
 
     _updateNextButtonSensitivity: function(sensitive) {
         this.nextButton.reactive = sensitive;
         this.nextButton.can_focus = sensitive;
     },
 
     updateSensitivity: function(sensitive) {
-        this._updateNextButtonSensitivity(sensitive && this._entry.text.length > 0);
+        this._updateNextButtonSensitivity(sensitive && (this._entry.text.length > 0 || this.verificationStatus == AuthPromptStatus.VERIFYING));
         this._entry.reactive = sensitive;
         this._entry.clutter_text.editable = sensitive;
     },
 
     hide: function() {
         this.setActorInDefaultButtonWell(null, true);
         this.actor.hide();
         this._message.opacity = 0;
 
         this.setUser(null);
 
         this.updateSensitivity(true);
         this._entry.set_text('');
     },
 
     setUser: function(user) {
         let oldChild = this._userWell.get_child();
         if (oldChild)
             oldChild.destroy();
 
         if (user) {
             let userWidget = new UserWidget.UserWidget(user);
             this._userWell.set_child(userWidget.actor);
         }
     },
 
     _onUserStoppedTypePreemptiveAnswer: function() {
         if (!this._preemptiveAnswerWatchId ||
             this._preemptiveAnswer ||
             this._queryingService)
-- 
2.13.0