summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2019-08-21 15:06:46 -0400
committerFlorian Müllner <fmuellner@gnome.org>2019-12-21 03:49:22 +0100
commit0a935b13b845c1827f1dbdf13d302cecef9c2286 (patch)
treea41c3ae590d8de17ebf21498ddcb17918bcdb9f6
parentf5f9bd2e5e1844449003b51084fe921bb7f59c3a (diff)
downloadgnome-shell-wip/lockdown-show-password.tar.gz
shellEntry: Support lockdown of "Show Text" menu in password entrieswip/lockdown-show-password
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
-rw-r--r--js/ui/shellEntry.js23
1 files changed, 22 insertions, 1 deletions
diff --git a/js/ui/shellEntry.js b/js/ui/shellEntry.js
index 884efc6b5..d8eba95e0 100644
--- a/js/ui/shellEntry.js
+++ b/js/ui/shellEntry.js
@@ -1,17 +1,24 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
/* exported addContextMenu CapsLockWarning */
-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;
const Params = imports.misc.params;
const PopupMenu = imports.ui.popupMenu;
+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._applyLockdownSettings.bind(this));
+
this._entry = entry;
this._clipboard = St.Clipboard.get_default();
@@ -39,6 +46,20 @@ var EntryMenu = class extends PopupMenu.PopupMenu {
item.connect('activate', this._onPasswordActivated.bind(this));
this.addMenuItem(item);
this._passwordItem = item;
+ this._applyLockdownSettings();
+ }
+
+ _applyLockdownSettings() {
+ if (!this._passwordItem)
+ return;
+
+ let passwordDisabled = this._lockdownSettings.get_boolean(DISABLE_SHOW_PASSWORD_KEY);
+
+ this._passwordItem.visible = !passwordDisabled;
+ this._entry.show_peek_icon = !passwordDisabled;
+
+ if (passwordDisabled)
+ this._entry.password_visible = false;
}
open(animate) {