unlockDialog: Create auth prompt on demand
AuthPrompt is the set of actors that contain the user avatar, the username, and the password entry. With the removal of the screen shield, the unlock dialog (be it UnlockDialog or the LoginDialog) is always created, and in the case of UnlockDialog, so is the auth prompt. This is problematic, though, since for passwordless accounts, the simple act of creating AuthPrompt authenticates the user, and lifts the lock screen. Create the AuthPrompt on deman in UnlockDialog. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/872
This commit is contained in:
parent
47d3203622
commit
3387c8787c
@ -445,34 +445,8 @@ var UnlockDialog = GObject.registerClass({
|
|||||||
stack.add_child(this._clock);
|
stack.add_child(this._clock);
|
||||||
this._showClock();
|
this._showClock();
|
||||||
|
|
||||||
this._authPrompt = new AuthPrompt.AuthPrompt(new Gdm.Client(), AuthPrompt.AuthPromptMode.UNLOCK_ONLY);
|
|
||||||
this._authPrompt.connect('failed', this._fail.bind(this));
|
|
||||||
this._authPrompt.connect('cancelled', this._fail.bind(this));
|
|
||||||
this._authPrompt.connect('reset', this._onReset.bind(this));
|
|
||||||
this._authPrompt.setPasswordChar('\u25cf');
|
|
||||||
this._authPrompt.nextButton.label = _("Unlock");
|
|
||||||
|
|
||||||
this._promptBox.add_child(this._authPrompt);
|
|
||||||
|
|
||||||
this.allowCancel = false;
|
this.allowCancel = false;
|
||||||
|
|
||||||
let screenSaverSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.screensaver' });
|
|
||||||
if (screenSaverSettings.get_boolean('user-switch-enabled')) {
|
|
||||||
let otherUserLabel = new St.Label({ text: _("Log in as another user"),
|
|
||||||
style_class: 'login-dialog-not-listed-label' });
|
|
||||||
this._otherUserButton = new St.Button({ style_class: 'login-dialog-not-listed-button',
|
|
||||||
can_focus: true,
|
|
||||||
child: otherUserLabel,
|
|
||||||
reactive: true });
|
|
||||||
this._otherUserButton.connect('clicked', this._otherUserClicked.bind(this));
|
|
||||||
this._promptBox.add_child(this._otherUserButton);
|
|
||||||
} else {
|
|
||||||
this._otherUserButton = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._authPrompt.reset();
|
|
||||||
this._updateSensitivity(true);
|
|
||||||
|
|
||||||
Main.ctrlAltTabManager.addGroup(this, _("Unlock Window"), 'dialog-password-symbolic');
|
Main.ctrlAltTabManager.addGroup(this, _("Unlock Window"), 'dialog-password-symbolic');
|
||||||
|
|
||||||
// Notifications
|
// Notifications
|
||||||
@ -554,6 +528,53 @@ var UnlockDialog = GObject.registerClass({
|
|||||||
this._createBackground(i);
|
this._createBackground(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_ensureAuthPrompt() {
|
||||||
|
if (this._authPrompt)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this._authPrompt = new AuthPrompt.AuthPrompt(new Gdm.Client(), AuthPrompt.AuthPromptMode.UNLOCK_ONLY);
|
||||||
|
this._authPrompt.connect('failed', this._fail.bind(this));
|
||||||
|
this._authPrompt.connect('cancelled', this._fail.bind(this));
|
||||||
|
this._authPrompt.connect('reset', this._onReset.bind(this));
|
||||||
|
this._authPrompt.setPasswordChar('\u25cf');
|
||||||
|
this._authPrompt.nextButton.label = _("Unlock");
|
||||||
|
|
||||||
|
this._promptBox.add_child(this._authPrompt);
|
||||||
|
|
||||||
|
let screenSaverSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.screensaver' });
|
||||||
|
if (screenSaverSettings.get_boolean('user-switch-enabled')) {
|
||||||
|
let otherUserLabel = new St.Label({
|
||||||
|
text: _("Log in as another user"),
|
||||||
|
style_class: 'login-dialog-not-listed-label',
|
||||||
|
});
|
||||||
|
this._otherUserButton = new St.Button({
|
||||||
|
style_class: 'login-dialog-not-listed-button',
|
||||||
|
can_focus: true,
|
||||||
|
child: otherUserLabel,
|
||||||
|
reactive: true,
|
||||||
|
});
|
||||||
|
this._otherUserButton.connect('clicked', this._otherUserClicked.bind(this));
|
||||||
|
this._promptBox.add_child(this._otherUserButton);
|
||||||
|
} else {
|
||||||
|
this._otherUserButton = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._authPrompt.reset();
|
||||||
|
this._updateSensitivity(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
_maybeDestroyAuthPrompt() {
|
||||||
|
this.grab_key_focus();
|
||||||
|
|
||||||
|
if (this._authPrompt) {
|
||||||
|
this._authPrompt.destroy();
|
||||||
|
this._authPrompt = null;
|
||||||
|
|
||||||
|
this._otherUserButton.destroy();
|
||||||
|
this._otherUserButton = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_updateSensitivity(sensitive) {
|
_updateSensitivity(sensitive) {
|
||||||
this._authPrompt.updateSensitivity(sensitive);
|
this._authPrompt.updateSensitivity(sensitive);
|
||||||
|
|
||||||
@ -574,7 +595,10 @@ var UnlockDialog = GObject.registerClass({
|
|||||||
opacity: 0,
|
opacity: 0,
|
||||||
duration: 300,
|
duration: 300,
|
||||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||||
onComplete: () => this._promptBox.hide(),
|
onComplete: () => {
|
||||||
|
this._promptBox.hide();
|
||||||
|
this._maybeDestroyAuthPrompt();
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
this._clock.ease({
|
this._clock.ease({
|
||||||
@ -585,6 +609,8 @@ var UnlockDialog = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
_showPrompt() {
|
_showPrompt() {
|
||||||
|
this._ensureAuthPrompt();
|
||||||
|
|
||||||
if (this._activePage == this._promptBox)
|
if (this._activePage == this._promptBox)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -654,6 +680,7 @@ var UnlockDialog = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
cancel() {
|
cancel() {
|
||||||
|
this._ensureAuthPrompt();
|
||||||
this._authPrompt.cancel();
|
this._authPrompt.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -663,6 +690,7 @@ var UnlockDialog = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
finish(onComplete) {
|
finish(onComplete) {
|
||||||
|
this._ensureAuthPrompt();
|
||||||
this._authPrompt.finish(onComplete);
|
this._authPrompt.finish(onComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user