[gnome-shell/wip/rstrode/login-screen-extensions: 134/134] shellEntry: Support lockdown of "Show Text" menu in password entries
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/rstrode/login-screen-extensions: 134/134] shellEntry: Support lockdown of "Show Text" menu in password entries
- Date: Thu, 26 Aug 2021 19:31:03 +0000 (UTC)
commit 61d9e04d248856a915155d5473b46c81d03c2123
Author: Ray Strode <rstrode redhat com>
Date: Wed Aug 21 15:06:46 2019 -0400
shellEntry: Support lockdown of "Show Text" menu in password entries
Some deployments require being able to prevent users from showing
the password they're currently typing.
This commit adds support for that kind of lockdown.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/687
js/ui/shellEntry.js | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/shellEntry.js b/js/ui/shellEntry.js
index 765cede062..c45e4545a6 100644
--- a/js/ui/shellEntry.js
+++ b/js/ui/shellEntry.js
@@ -1,6 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
-const { Clutter, GObject, Pango, Shell, St } = imports.gi;
+const { Clutter, Gio, GObject, Pango, Shell, St } = imports.gi;
const BoxPointer = imports.ui.boxpointer;
const Main = imports.ui.main;
@@ -8,10 +8,16 @@ const Params = imports.misc.params;
const PopupMenu = imports.ui.popupMenu;
const Tweener = imports.ui.tweener;
+const LOCKDOWN_SCHEMA = 'org.gnome.desktop.lockdown';
+const DISABLE_SHOW_PASSWORD_KEY = 'disable-show-password';
+
var EntryMenu = class extends PopupMenu.PopupMenu {
constructor(entry) {
super(entry, 0, St.Side.TOP);
+ this._lockdownSettings = new Gio.Settings({ schema_id: LOCKDOWN_SCHEMA });
+ this._lockdownSettings.connect('changed::' + DISABLE_SHOW_PASSWORD_KEY,
this._resetPasswordItem.bind(this));
+
this._entry = entry;
this._clipboard = St.Clipboard.get_default();
@@ -42,13 +48,15 @@ var EntryMenu = class extends PopupMenu.PopupMenu {
}
_resetPasswordItem() {
- if (!this.isPassword) {
+ let passwordDisabled = this._lockdownSettings.get_boolean(DISABLE_SHOW_PASSWORD_KEY);
+
+ if (!this.isPassword || passwordDisabled) {
if (this._passwordItem) {
this._passwordItem.destroy();
this._passwordItem = null;
}
this._entry.clutter_text.set_password_char('\u25cf');
- } else {
+ } else if (this.isPassword && !passwordDisabled) {
if (!this._passwordItem)
this._makePasswordItem();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]