[gnome-shell/wip/rstrode/rhel-8.0.0: 10/50] authPrompt: stop accepting preemptive answer if user stops typing
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/rstrode/rhel-8.0.0: 10/50] authPrompt: stop accepting preemptive answer if user stops typing
- Date: Sun, 17 Feb 2019 17:29:41 +0000 (UTC)
commit 241585479bc65085f823f5ca4666f34018d9f354
Author: Ray Strode <rstrode redhat com>
Date: Mon Oct 5 15:26:18 2015 -0400
authPrompt: stop accepting preemptive answer if user stops typing
We only want to allow the user to type the preemptive password in
one smooth motion. If they start to type, and then stop typing,
we should discard their preemptive password as expired.
Typing ahead the password is just a convenience for users who don't
want to manually lift the shift before typing their passwords, after
all.
js/gdm/authPrompt.js | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
---
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
index f18ef41f2..89cef4d5d 100644
--- a/js/gdm/authPrompt.js
+++ b/js/gdm/authPrompt.js
@@ -10,6 +10,7 @@ const St = imports.gi.St;
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;
@@ -47,6 +48,8 @@ var AuthPrompt = new Lang.Class({
this._gdmClient = gdmClient;
this._mode = mode;
+ this._idleMonitor = Meta.IdleMonitor.get_core();
+
let reauthenticationOnly;
if (this._mode == AuthPromptMode.UNLOCK_ONLY)
reauthenticationOnly = true;
@@ -71,6 +74,11 @@ var AuthPrompt = new Lang.Class({
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;
+ }
}
});
@@ -135,6 +143,11 @@ var AuthPrompt = new Lang.Class({
},
_onDestroy() {
+ if (this._preemptiveAnswerWatchId) {
+ this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId);
+ this._preemptiveAnswerWatchId = 0;
+ }
+
this._userVerifier.destroy();
this._userVerifier = null;
},
@@ -349,6 +362,11 @@ var AuthPrompt = new Lang.Class({
},
setQuestion(question) {
+ if (this._preemptiveAnswerWatchId) {
+ this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId);
+ this._preemptiveAnswerWatchId = 0;
+ }
+
this._label.set_text(question);
this._label.show();
@@ -434,12 +452,31 @@ var AuthPrompt = new Lang.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;
this.cancelButton.reactive = true;
this.nextButton.label = _("Next");
+ 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();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]