From 3df8f3f325a308a7b7c93fb70abc8b6741871c0c Mon Sep 17 00:00:00 2001 From: rpm-build Date: Feb 04 2021 06:16:15 +0000 Subject: disable-unlock-entry-until-question.patch patch_name: disable-unlock-entry-until-question.patch present_in_specfile: true location_in_specfile: 6 --- diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js index d7f53a9..27eb31a 100644 --- a/js/gdm/authPrompt.js +++ b/js/gdm/authPrompt.js @@ -6,6 +6,7 @@ const Signals = imports.signals; const Animation = imports.ui.animation; const Batch = imports.gdm.batch; const GdmUtil = imports.gdm.util; +const Meta = imports.gi.Meta; const Params = imports.misc.params; const ShellEntry = imports.ui.shellEntry; const Tweener = imports.ui.tweener; @@ -41,6 +42,8 @@ var AuthPrompt = class { this._gdmClient = gdmClient; this._mode = mode; + this._idleMonitor = Meta.IdleMonitor.get_core(); + let reauthenticationOnly; if (this._mode == AuthPromptMode.UNLOCK_ONLY) reauthenticationOnly = true; @@ -60,11 +63,16 @@ var AuthPrompt = class { this.connect('next', () => { this.updateSensitivity(false); - this.startSpinning(); if (this._queryingService) { + this.startSpinning(); this._userVerifier.answerQuery(this._queryingService, this._entry.text); } else { this._preemptiveAnswer = this._entry.text; + + if (this._preemptiveAnswerWatchId) { + this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId); + this._preemptiveAnswerWatchId = 0; + } } }); @@ -128,6 +136,11 @@ var AuthPrompt = class { } _onDestroy() { + if (this._preemptiveAnswerWatchId) { + this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId); + this._preemptiveAnswerWatchId = 0; + } + this._userVerifier.destroy(); this._userVerifier = null; } @@ -169,7 +182,7 @@ var AuthPrompt = class { this._updateNextButtonSensitivity(this._entry.text.length > 0); this._entry.clutter_text.connect('text-changed', () => { - if (!this._userVerifier.hasPendingMessages) + if (!this._userVerifier.hasPendingMessages && this._queryingService && !this._preemptiveAnswer) this._fadeOutMessage(); this._updateNextButtonSensitivity(this._entry.text.length > 0 || this.verificationStatus == AuthPromptStatus.VERIFYING); @@ -342,6 +355,11 @@ var AuthPrompt = class { } setQuestion(question) { + if (this._preemptiveAnswerWatchId) { + this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId); + this._preemptiveAnswerWatchId = 0; + } + this._label.set_text(question); this._label.show(); @@ -427,6 +445,19 @@ var AuthPrompt = class { } } + _onUserStoppedTypePreemptiveAnswer() { + if (!this._preemptiveAnswerWatchId || + this._preemptiveAnswer || + this._queryingService) + return; + + this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId); + this._preemptiveAnswerWatchId = 0; + + this._entry.text = ''; + this.updateSensitivity(false); + } + reset() { let oldStatus = this.verificationStatus; this.verificationStatus = AuthPromptStatus.NOT_VERIFYING; @@ -434,6 +465,12 @@ var AuthPrompt = class { this.nextButton.label = _("Next"); this._preemptiveAnswer = null; + if (this._preemptiveAnswerWatchId) { + this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId); + } + this._preemptiveAnswerWatchId = this._idleMonitor.add_idle_watch (500, + this._onUserStoppedTypePreemptiveAnswer.bind(this)); + if (this._userVerifier) this._userVerifier.cancel();