summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Müllner <fmuellner@gnome.org>2018-04-06 19:54:27 +0200
committerFlorian Müllner <fmuellner@gnome.org>2018-04-06 20:08:29 +0200
commit78a92fb6bea26a7be712f72b730130efe3728d06 (patch)
tree9cca8653230ac8537603f952df23ed5d250ae30f
parent01509cf1a5ec3d44622453b08cc7815d776c94a4 (diff)
downloadgnome-shell-wip/fmuellner/delay-auth-when-locked.tar.gz
polkitAgent: Queue authentication requests while lockedwip/fmuellner/delay-auth-when-locked
While polkit requests *should* be the result of a user action, that's not always the case in practice and authentication dialogs can pop up out of nowhere at any time. That's always annoying, but particularly bad on the lock screen. If we disabled the polkit component altogether, the fallback GTK-based agent would kick in, so instead handle the case explicitly and postpone showing the dialog until the session is unlocked. https://gitlab.gnome.org/GNOME/gnome-shell/issues/179
-rw-r--r--js/ui/components/polkitAgent.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/js/ui/components/polkitAgent.js b/js/ui/components/polkitAgent.js
index b45356875..d14d9d3ac 100644
--- a/js/ui/components/polkitAgent.js
+++ b/js/ui/components/polkitAgent.js
@@ -16,6 +16,7 @@ const PolkitAgent = imports.gi.PolkitAgent;
const Animation = imports.ui.animation;
const Components = imports.ui.components;
const Dialog = imports.ui.dialog;
+const Main = imports.ui.main;
const ModalDialog = imports.ui.modalDialog;
const ShellEntry = imports.ui.shellEntry;
const UserWidget = imports.ui.userWidget;
@@ -348,6 +349,7 @@ var AuthenticationAgent = new Lang.Class({
this._native = new Shell.PolkitAuthenticationAgent();
this._native.connect('initiate', this._onInitiate.bind(this));
this._native.connect('cancel', this._onCancel.bind(this));
+ this._sessionUpdatedId = 0;
},
enable() {
@@ -367,6 +369,17 @@ var AuthenticationAgent = new Lang.Class({
},
_onInitiate(nativeAgent, actionId, message, iconName, cookie, userNames) {
+ // Don't pop up a dialog while locked
+ if (Main.sessionMode.isLocked) {
+ this._sessionUpdatedId = Main.sessionMode.connect('updated', () => {
+ Main.sessionMode.disconnect(this._sessionUpdatedId);
+ this._sessionUpdatedId = 0;
+
+ this._onInitiate(nativeAgent, actionId, message, iconName, cookie, userNames);
+ });
+ return;
+ }
+
this._currentDialog = new AuthenticationDialog(actionId, message, cookie, userNames);
// We actually don't want to open the dialog until we know for
@@ -396,6 +409,10 @@ var AuthenticationAgent = new Lang.Class({
this._currentDialog.destroySession();
this._currentDialog = null;
+ if (this._sessionUpdatedId)
+ Main.sessionMode.disconnect(this._sessionUpdatedId);
+ this._sessionUpdatedId = 0;
+
this._native.complete(dismissed);
},
});