|
|
86957c |
From f821b65401284cc31f68f0eb1b2e71ae3a90a122 Mon Sep 17 00:00:00 2001
|
|
|
0999a2 |
From: Ray Strode <rstrode@redhat.com>
|
|
|
0999a2 |
Date: Tue, 18 Jul 2017 12:58:14 -0400
|
|
|
86957c |
Subject: [PATCH 1/2] gdm: Add AuthList control
|
|
|
0999a2 |
|
|
|
0999a2 |
Ultimately, we want to add support for GDM's new ChoiceList
|
|
|
0999a2 |
PAM extension. That extension allows PAM modules to present
|
|
|
0999a2 |
a list of choices to the user. Before we can support that
|
|
|
0999a2 |
extension, however, we need to have a list control in the
|
|
|
0999a2 |
login-screen/unlock screen. This commit adds that control.
|
|
|
0999a2 |
|
|
|
0999a2 |
For the most part, it's a copy-and-paste of the gdm userlist,
|
|
|
0999a2 |
but with less features. It lacks API specific to the users,
|
|
|
0999a2 |
lacks the built in timed login indicator, etc. It does feature
|
|
|
0999a2 |
a label heading.
|
|
|
0999a2 |
---
|
|
|
86957c |
.../widgets/_login-dialog.scss | 26 +++
|
|
|
86957c |
js/gdm/authList.js | 176 ++++++++++++++++++
|
|
|
86957c |
js/js-resources.gresource.xml | 1 +
|
|
|
86957c |
3 files changed, 203 insertions(+)
|
|
|
0999a2 |
create mode 100644 js/gdm/authList.js
|
|
|
0999a2 |
|
|
|
86957c |
diff --git a/data/theme/gnome-shell-sass/widgets/_login-dialog.scss b/data/theme/gnome-shell-sass/widgets/_login-dialog.scss
|
|
|
86957c |
index 84539342d..f68d5de99 100644
|
|
|
86957c |
--- a/data/theme/gnome-shell-sass/widgets/_login-dialog.scss
|
|
|
86957c |
+++ b/data/theme/gnome-shell-sass/widgets/_login-dialog.scss
|
|
|
86957c |
@@ -86,60 +86,86 @@
|
|
|
86957c |
.caps-lock-warning-label,
|
|
|
86957c |
.login-dialog-message-warning {
|
|
|
86957c |
color: $osd_fg_color;
|
|
|
86957c |
}
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
.login-dialog-logo-bin { padding: 24px 0px; }
|
|
|
86957c |
.login-dialog-banner { color: darken($osd_fg_color,10%); }
|
|
|
86957c |
.login-dialog-button-box { width: 23em; spacing: 5px; }
|
|
|
86957c |
.login-dialog-message { text-align: center; }
|
|
|
86957c |
.login-dialog-message-hint, .login-dialog-message {
|
|
|
86957c |
color: darken($osd_fg_color, 20%);
|
|
|
86957c |
min-height: 2.75em;
|
|
|
86957c |
}
|
|
|
86957c |
.login-dialog-user-selection-box { padding: 100px 0px; }
|
|
|
86957c |
.login-dialog-not-listed-label {
|
|
|
86957c |
padding-left: 2px;
|
|
|
86957c |
.login-dialog-not-listed-button:focus &,
|
|
|
86957c |
.login-dialog-not-listed-button:hover & {
|
|
|
86957c |
color: $osd_fg_color;
|
|
|
86957c |
}
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
.login-dialog-not-listed-label {
|
|
|
86957c |
@include fontsize($base_font_size - 1);
|
|
|
86957c |
font-weight: bold;
|
|
|
86957c |
color: darken($osd_fg_color,30%);
|
|
|
86957c |
padding-top: 1em;
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
+.login-dialog-auth-list-view { -st-vfade-offset: 1em; }
|
|
|
86957c |
+.login-dialog-auth-list {
|
|
|
86957c |
+ spacing: 6px;
|
|
|
86957c |
+ margin-left: 2em;
|
|
|
86957c |
+}
|
|
|
86957c |
+
|
|
|
86957c |
+.login-dialog-auth-list-title {
|
|
|
86957c |
+ margin-left: 2em;
|
|
|
86957c |
+}
|
|
|
86957c |
+
|
|
|
86957c |
+.login-dialog-auth-list-item {
|
|
|
86957c |
+ border-radius: $base_border_radius + 4px;
|
|
|
86957c |
+ padding: 6px;
|
|
|
86957c |
+ color: darken($osd_fg_color,30%);
|
|
|
86957c |
+ &:focus, &:selected { background-color: $selected_bg_color; color: $selected_fg_color; }
|
|
|
86957c |
+}
|
|
|
86957c |
+
|
|
|
86957c |
+.login-dialog-auth-list-label {
|
|
|
86957c |
+ @include fontsize($base_font_size + 2);
|
|
|
86957c |
+ font-weight: bold;
|
|
|
86957c |
+ padding-left: 15px;
|
|
|
86957c |
+
|
|
|
86957c |
+ &:ltr { padding-left: 14px; text-align: left; }
|
|
|
86957c |
+ &:rtl { padding-right: 14px; text-align: right; }
|
|
|
86957c |
+}
|
|
|
86957c |
+
|
|
|
86957c |
.login-dialog-user-list-view { -st-vfade-offset: 1em; }
|
|
|
86957c |
.login-dialog-user-list {
|
|
|
86957c |
spacing: 12px;
|
|
|
86957c |
width: 23em;
|
|
|
86957c |
&:expanded .login-dialog-user-list-item:selected { background-color: $selected_bg_color; color: $selected_fg_color; }
|
|
|
86957c |
&:expanded .login-dialog-user-list-item:logged-in { border-right: 2px solid $selected_bg_color; }
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
.login-dialog-user-list-item {
|
|
|
86957c |
border-radius: $base_border_radius + 4px;
|
|
|
86957c |
padding: 6px;
|
|
|
86957c |
color: darken($osd_fg_color,30%);
|
|
|
86957c |
&:ltr .user-widget { padding-right: 1em; }
|
|
|
86957c |
&:rtl .user-widget { padding-left: 1em; }
|
|
|
86957c |
.login-dialog-timed-login-indicator {
|
|
|
86957c |
height: 2px;
|
|
|
86957c |
margin-top: 6px;
|
|
|
86957c |
background-color: $osd_fg_color;
|
|
|
86957c |
}
|
|
|
86957c |
&:focus .login-dialog-timed-login-indicator { background-color: $selected_fg_color; }
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
.user-widget-label {
|
|
|
86957c |
color: $osd_fg_color;
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
.user-widget.horizontal .user-widget-label {
|
|
|
86957c |
@include fontsize($base_font_size + 2);
|
|
|
86957c |
font-weight: bold;
|
|
|
86957c |
padding-left: 15px;
|
|
|
0999a2 |
diff --git a/js/gdm/authList.js b/js/gdm/authList.js
|
|
|
0999a2 |
new file mode 100644
|
|
|
86957c |
index 000000000..fb223a972
|
|
|
0999a2 |
--- /dev/null
|
|
|
0999a2 |
+++ b/js/gdm/authList.js
|
|
|
86957c |
@@ -0,0 +1,176 @@
|
|
|
0999a2 |
+// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
|
|
0999a2 |
+/*
|
|
|
0999a2 |
+ * Copyright 2017 Red Hat, Inc
|
|
|
0999a2 |
+ *
|
|
|
0999a2 |
+ * This program is free software; you can redistribute it and/or modify
|
|
|
0999a2 |
+ * it under the terms of the GNU General Public License as published by
|
|
|
0999a2 |
+ * the Free Software Foundation; either version 2, or (at your option)
|
|
|
0999a2 |
+ * any later version.
|
|
|
0999a2 |
+ *
|
|
|
0999a2 |
+ * This program is distributed in the hope that it will be useful,
|
|
|
0999a2 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
0999a2 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
0999a2 |
+ * GNU General Public License for more details.
|
|
|
0999a2 |
+ *
|
|
|
0999a2 |
+ * You should have received a copy of the GNU General Public License
|
|
|
0999a2 |
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
|
0999a2 |
+ */
|
|
|
0999a2 |
+/* exported AuthList */
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+const { Clutter, GObject, Meta, St } = imports.gi;
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+const SCROLL_ANIMATION_TIME = 500;
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+const AuthListItem = GObject.registerClass({
|
|
|
0999a2 |
+ Signals: { 'activate': {} },
|
|
|
0999a2 |
+}, class AuthListItem extends St.Button {
|
|
|
0999a2 |
+ _init(key, text) {
|
|
|
0999a2 |
+ this.key = key;
|
|
|
0999a2 |
+ const label = new St.Label({
|
|
|
86957c |
+ text,
|
|
|
86957c |
+ style_class: 'login-dialog-auth-list-label',
|
|
|
0999a2 |
+ y_align: Clutter.ActorAlign.CENTER,
|
|
|
86957c |
+ x_expand: false,
|
|
|
0999a2 |
+ });
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ super._init({
|
|
|
86957c |
+ style_class: 'login-dialog-auth-list-item',
|
|
|
0999a2 |
+ button_mask: St.ButtonMask.ONE | St.ButtonMask.THREE,
|
|
|
0999a2 |
+ can_focus: true,
|
|
|
0999a2 |
+ child: label,
|
|
|
0999a2 |
+ reactive: true,
|
|
|
0999a2 |
+ });
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ this.connect('key-focus-in',
|
|
|
0999a2 |
+ () => this._setSelected(true));
|
|
|
0999a2 |
+ this.connect('key-focus-out',
|
|
|
0999a2 |
+ () => this._setSelected(false));
|
|
|
0999a2 |
+ this.connect('notify::hover',
|
|
|
0999a2 |
+ () => this._setSelected(this.hover));
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ this.connect('clicked', this._onClicked.bind(this));
|
|
|
0999a2 |
+ }
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ _onClicked() {
|
|
|
0999a2 |
+ this.emit('activate');
|
|
|
0999a2 |
+ }
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ _setSelected(selected) {
|
|
|
0999a2 |
+ if (selected) {
|
|
|
0999a2 |
+ this.add_style_pseudo_class('selected');
|
|
|
0999a2 |
+ this.grab_key_focus();
|
|
|
0999a2 |
+ } else {
|
|
|
0999a2 |
+ this.remove_style_pseudo_class('selected');
|
|
|
0999a2 |
+ }
|
|
|
0999a2 |
+ }
|
|
|
0999a2 |
+});
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+var AuthList = GObject.registerClass({
|
|
|
0999a2 |
+ Signals: {
|
|
|
0999a2 |
+ 'activate': { param_types: [GObject.TYPE_STRING] },
|
|
|
0999a2 |
+ 'item-added': { param_types: [AuthListItem.$gtype] },
|
|
|
0999a2 |
+ },
|
|
|
0999a2 |
+}, class AuthList extends St.BoxLayout {
|
|
|
0999a2 |
+ _init() {
|
|
|
0999a2 |
+ super._init({
|
|
|
0999a2 |
+ vertical: true,
|
|
|
0999a2 |
+ style_class: 'login-dialog-auth-list-layout',
|
|
|
86957c |
+ x_align: Clutter.ActorAlign.START,
|
|
|
86957c |
+ y_align: Clutter.ActorAlign.CENTER,
|
|
|
0999a2 |
+ });
|
|
|
0999a2 |
+
|
|
|
86957c |
+ this.label = new St.Label({ style_class: 'login-dialog-auth-list-title' });
|
|
|
0999a2 |
+ this.add_child(this.label);
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ this._scrollView = new St.ScrollView({
|
|
|
86957c |
+ style_class: 'login-dialog-auth-list-view',
|
|
|
0999a2 |
+ });
|
|
|
0999a2 |
+ this._scrollView.set_policy(
|
|
|
0999a2 |
+ St.PolicyType.NEVER, St.PolicyType.AUTOMATIC);
|
|
|
0999a2 |
+ this.add_child(this._scrollView);
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ this._box = new St.BoxLayout({
|
|
|
0999a2 |
+ vertical: true,
|
|
|
86957c |
+ style_class: 'login-dialog-auth-list',
|
|
|
0999a2 |
+ pseudo_class: 'expanded',
|
|
|
0999a2 |
+ });
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ this._scrollView.add_actor(this._box);
|
|
|
86957c |
+ this._items = new Map();
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ this.connect('key-focus-in', this._moveFocusToItems.bind(this));
|
|
|
0999a2 |
+ }
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ _moveFocusToItems() {
|
|
|
86957c |
+ let hasItems = this.numItems > 0;
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ if (!hasItems)
|
|
|
0999a2 |
+ return;
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ if (global.stage.get_key_focus() !== this)
|
|
|
0999a2 |
+ return;
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ let focusSet = this.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
|
|
|
0999a2 |
+ if (!focusSet) {
|
|
|
0999a2 |
+ Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
|
|
0999a2 |
+ this._moveFocusToItems();
|
|
|
0999a2 |
+ return false;
|
|
|
0999a2 |
+ });
|
|
|
0999a2 |
+ }
|
|
|
0999a2 |
+ }
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ _onItemActivated(activatedItem) {
|
|
|
0999a2 |
+ this.emit('activate', activatedItem.key);
|
|
|
0999a2 |
+ }
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ scrollToItem(item) {
|
|
|
0999a2 |
+ let box = item.get_allocation_box();
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ let adjustment = this._scrollView.get_vscroll_bar().get_adjustment();
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ let value = (box.y1 + adjustment.step_increment / 2.0) - (adjustment.page_size / 2.0);
|
|
|
0999a2 |
+ adjustment.ease(value, {
|
|
|
0999a2 |
+ duration: SCROLL_ANIMATION_TIME,
|
|
|
0999a2 |
+ mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
|
|
0999a2 |
+ });
|
|
|
0999a2 |
+ }
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ addItem(key, text) {
|
|
|
0999a2 |
+ this.removeItem(key);
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ let item = new AuthListItem(key, text);
|
|
|
86957c |
+ this._box.add(item);
|
|
|
0999a2 |
+
|
|
|
86957c |
+ this._items.set(key, item);
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ item.connect('activate', this._onItemActivated.bind(this));
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ // Try to keep the focused item front-and-center
|
|
|
0999a2 |
+ item.connect('key-focus-in', () => this.scrollToItem(item));
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ this._moveFocusToItems();
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ this.emit('item-added', item);
|
|
|
0999a2 |
+ }
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ removeItem(key) {
|
|
|
86957c |
+ if (!this._items.has(key))
|
|
|
0999a2 |
+ return;
|
|
|
0999a2 |
+
|
|
|
86957c |
+ let item = this._items.get(key);
|
|
|
86957c |
+
|
|
|
0999a2 |
+ item.destroy();
|
|
|
86957c |
+
|
|
|
86957c |
+ this._items.delete(key);
|
|
|
0999a2 |
+ }
|
|
|
0999a2 |
+
|
|
|
86957c |
+ get numItems() {
|
|
|
86957c |
+ return this._items.size;
|
|
|
0999a2 |
+ }
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ clear() {
|
|
|
0999a2 |
+ this.label.text = '';
|
|
|
0999a2 |
+ this._box.destroy_all_children();
|
|
|
86957c |
+ this._items.clear();
|
|
|
0999a2 |
+ }
|
|
|
0999a2 |
+});
|
|
|
0999a2 |
diff --git a/js/js-resources.gresource.xml b/js/js-resources.gresource.xml
|
|
|
0999a2 |
index e65e0e9cf..b2c603a55 100644
|
|
|
0999a2 |
--- a/js/js-resources.gresource.xml
|
|
|
0999a2 |
+++ b/js/js-resources.gresource.xml
|
|
|
86957c |
@@ -1,33 +1,34 @@
|
|
|
0999a2 |
|
|
|
0999a2 |
<gresources>
|
|
|
0999a2 |
<gresource prefix="/org/gnome/shell">
|
|
|
0999a2 |
+ <file>gdm/authList.js</file>
|
|
|
0999a2 |
<file>gdm/authPrompt.js</file>
|
|
|
0999a2 |
<file>gdm/batch.js</file>
|
|
|
0999a2 |
<file>gdm/loginDialog.js</file>
|
|
|
86957c |
<file>gdm/oVirt.js</file>
|
|
|
86957c |
<file>gdm/credentialManager.js</file>
|
|
|
86957c |
<file>gdm/vmware.js</file>
|
|
|
86957c |
<file>gdm/realmd.js</file>
|
|
|
86957c |
<file>gdm/util.js</file>
|
|
|
86957c |
|
|
|
86957c |
<file>misc/config.js</file>
|
|
|
86957c |
<file>misc/extensionUtils.js</file>
|
|
|
86957c |
<file>misc/fileUtils.js</file>
|
|
|
86957c |
<file>misc/gnomeSession.js</file>
|
|
|
86957c |
<file>misc/history.js</file>
|
|
|
86957c |
<file>misc/ibusManager.js</file>
|
|
|
86957c |
<file>misc/inputMethod.js</file>
|
|
|
86957c |
<file>misc/introspect.js</file>
|
|
|
86957c |
<file>misc/jsParse.js</file>
|
|
|
86957c |
<file>misc/keyboardManager.js</file>
|
|
|
86957c |
<file>misc/loginManager.js</file>
|
|
|
86957c |
<file>misc/modemManager.js</file>
|
|
|
86957c |
<file>misc/objectManager.js</file>
|
|
|
86957c |
<file>misc/params.js</file>
|
|
|
86957c |
<file>misc/parentalControlsManager.js</file>
|
|
|
86957c |
<file>misc/permissionStore.js</file>
|
|
|
86957c |
<file>misc/smartcardManager.js</file>
|
|
|
86957c |
<file>misc/systemActions.js</file>
|
|
|
86957c |
<file>misc/util.js</file>
|
|
|
86957c |
<file>misc/weather.js</file>
|
|
|
86957c |
|
|
|
0999a2 |
--
|
|
|
86957c |
2.34.1
|
|
|
0999a2 |
|
|
|
86957c |
From 5a2fda2fe2526f81c4dbbee6512182f19fc76a74 Mon Sep 17 00:00:00 2001
|
|
|
0999a2 |
From: Ray Strode <rstrode@redhat.com>
|
|
|
0999a2 |
Date: Mon, 17 Jul 2017 16:48:03 -0400
|
|
|
86957c |
Subject: [PATCH 2/2] gdmUtil: Enable support for GDM's ChoiceList PAM
|
|
|
0999a2 |
extension
|
|
|
0999a2 |
|
|
|
0999a2 |
This commit hooks up support for GDM's ChoiceList PAM extension.
|
|
|
0999a2 |
---
|
|
|
86957c |
js/gdm/authPrompt.js | 71 +++++++++++++++++++++++++++++++++++++++++--
|
|
|
86957c |
js/gdm/loginDialog.js | 5 +++
|
|
|
86957c |
js/gdm/util.js | 28 +++++++++++++++++
|
|
|
0999a2 |
js/ui/unlockDialog.js | 7 +++++
|
|
|
86957c |
4 files changed, 109 insertions(+), 2 deletions(-)
|
|
|
0999a2 |
|
|
|
0999a2 |
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
|
|
|
86957c |
index 84c608b2f..4da91e096 100644
|
|
|
0999a2 |
--- a/js/gdm/authPrompt.js
|
|
|
0999a2 |
+++ b/js/gdm/authPrompt.js
|
|
|
86957c |
@@ -1,36 +1,37 @@
|
|
|
86957c |
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
|
|
86957c |
/* exported AuthPrompt */
|
|
|
86957c |
|
|
|
0999a2 |
const { Clutter, GLib, GObject, Meta, Pango, Shell, St } = imports.gi;
|
|
|
0999a2 |
|
|
|
0999a2 |
const Animation = imports.ui.animation;
|
|
|
0999a2 |
+const AuthList = imports.gdm.authList;
|
|
|
0999a2 |
const Batch = imports.gdm.batch;
|
|
|
0999a2 |
const GdmUtil = imports.gdm.util;
|
|
|
0999a2 |
const OVirt = imports.gdm.oVirt;
|
|
|
86957c |
const Vmware = imports.gdm.vmware;
|
|
|
86957c |
const Params = imports.misc.params;
|
|
|
86957c |
const ShellEntry = imports.ui.shellEntry;
|
|
|
86957c |
const UserWidget = imports.ui.userWidget;
|
|
|
86957c |
const Util = imports.misc.util;
|
|
|
86957c |
|
|
|
86957c |
var DEFAULT_BUTTON_WELL_ICON_SIZE = 16;
|
|
|
86957c |
var DEFAULT_BUTTON_WELL_ANIMATION_DELAY = 1000;
|
|
|
86957c |
var DEFAULT_BUTTON_WELL_ANIMATION_TIME = 300;
|
|
|
86957c |
|
|
|
86957c |
var MESSAGE_FADE_OUT_ANIMATION_TIME = 500;
|
|
|
86957c |
|
|
|
86957c |
var AuthPromptMode = {
|
|
|
86957c |
UNLOCK_ONLY: 0,
|
|
|
86957c |
UNLOCK_OR_LOG_IN: 1,
|
|
|
86957c |
};
|
|
|
86957c |
|
|
|
86957c |
var AuthPromptStatus = {
|
|
|
86957c |
NOT_VERIFYING: 0,
|
|
|
86957c |
VERIFYING: 1,
|
|
|
86957c |
VERIFICATION_FAILED: 2,
|
|
|
86957c |
VERIFICATION_SUCCEEDED: 3,
|
|
|
86957c |
VERIFICATION_CANCELLED: 4,
|
|
|
86957c |
VERIFICATION_IN_PROGRESS: 5,
|
|
|
86957c |
};
|
|
|
86957c |
|
|
|
86957c |
var BeginRequestType = {
|
|
|
86957c |
@@ -48,144 +49,164 @@ var AuthPrompt = GObject.registerClass({
|
|
|
86957c |
'reset': { param_types: [GObject.TYPE_UINT] },
|
|
|
86957c |
},
|
|
|
86957c |
}, class AuthPrompt extends St.BoxLayout {
|
|
|
86957c |
_init(gdmClient, mode) {
|
|
|
86957c |
super._init({
|
|
|
86957c |
style_class: 'login-dialog-prompt-layout',
|
|
|
86957c |
vertical: true,
|
|
|
86957c |
x_expand: true,
|
|
|
86957c |
x_align: Clutter.ActorAlign.CENTER,
|
|
|
86957c |
});
|
|
|
86957c |
|
|
|
86957c |
this.verificationStatus = AuthPromptStatus.NOT_VERIFYING;
|
|
|
86957c |
|
|
|
86957c |
this._gdmClient = gdmClient;
|
|
|
86957c |
this._mode = mode;
|
|
|
86957c |
this._defaultButtonWellActor = null;
|
|
|
86957c |
this._cancelledRetries = 0;
|
|
|
86957c |
|
|
|
86957c |
this._idleMonitor = Meta.IdleMonitor.get_core();
|
|
|
86957c |
|
|
|
86957c |
let reauthenticationOnly;
|
|
|
86957c |
if (this._mode == AuthPromptMode.UNLOCK_ONLY)
|
|
|
86957c |
reauthenticationOnly = true;
|
|
|
86957c |
else if (this._mode == AuthPromptMode.UNLOCK_OR_LOG_IN)
|
|
|
86957c |
reauthenticationOnly = false;
|
|
|
86957c |
|
|
|
86957c |
this._userVerifier = new GdmUtil.ShellUserVerifier(this._gdmClient, { reauthenticationOnly });
|
|
|
0999a2 |
|
|
|
0999a2 |
this._userVerifier.connect('ask-question', this._onAskQuestion.bind(this));
|
|
|
0999a2 |
this._userVerifier.connect('show-message', this._onShowMessage.bind(this));
|
|
|
0999a2 |
+ this._userVerifier.connect('show-choice-list', this._onShowChoiceList.bind(this));
|
|
|
0999a2 |
this._userVerifier.connect('verification-failed', this._onVerificationFailed.bind(this));
|
|
|
0999a2 |
this._userVerifier.connect('verification-complete', this._onVerificationComplete.bind(this));
|
|
|
0999a2 |
this._userVerifier.connect('reset', this._onReset.bind(this));
|
|
|
86957c |
this._userVerifier.connect('smartcard-status-changed', this._onSmartcardStatusChanged.bind(this));
|
|
|
86957c |
this._userVerifier.connect('credential-manager-authenticated', this._onCredentialManagerAuthenticated.bind(this));
|
|
|
86957c |
this.smartcardDetected = this._userVerifier.smartcardDetected;
|
|
|
86957c |
|
|
|
86957c |
this.connect('destroy', this._onDestroy.bind(this));
|
|
|
86957c |
|
|
|
86957c |
this._userWell = new St.Bin({
|
|
|
86957c |
x_expand: true,
|
|
|
86957c |
y_expand: true,
|
|
|
86957c |
});
|
|
|
86957c |
this.add_child(this._userWell);
|
|
|
86957c |
|
|
|
86957c |
this._hasCancelButton = this._mode === AuthPromptMode.UNLOCK_OR_LOG_IN;
|
|
|
86957c |
|
|
|
86957c |
- this._initEntryRow();
|
|
|
86957c |
+ this._initInputRow();
|
|
|
86957c |
|
|
|
86957c |
let capsLockPlaceholder = new St.Label();
|
|
|
86957c |
this.add_child(capsLockPlaceholder);
|
|
|
86957c |
|
|
|
86957c |
this._capsLockWarningLabel = new ShellEntry.CapsLockWarning({
|
|
|
86957c |
x_expand: true,
|
|
|
86957c |
x_align: Clutter.ActorAlign.CENTER,
|
|
|
86957c |
});
|
|
|
86957c |
this.add_child(this._capsLockWarningLabel);
|
|
|
86957c |
|
|
|
86957c |
this._capsLockWarningLabel.bind_property('visible',
|
|
|
0999a2 |
capsLockPlaceholder, 'visible',
|
|
|
0999a2 |
GObject.BindingFlags.SYNC_CREATE | GObject.BindingFlags.INVERT_BOOLEAN);
|
|
|
0999a2 |
|
|
|
86957c |
this._message = new St.Label({
|
|
|
86957c |
opacity: 0,
|
|
|
86957c |
styleClass: 'login-dialog-message',
|
|
|
86957c |
y_expand: true,
|
|
|
86957c |
x_expand: true,
|
|
|
86957c |
y_align: Clutter.ActorAlign.START,
|
|
|
86957c |
x_align: Clutter.ActorAlign.CENTER,
|
|
|
86957c |
});
|
|
|
86957c |
this._message.clutter_text.line_wrap = true;
|
|
|
86957c |
this._message.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
|
|
86957c |
this.add_child(this._message);
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
_onDestroy() {
|
|
|
86957c |
if (this._preemptiveAnswerWatchId) {
|
|
|
86957c |
this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId);
|
|
|
86957c |
this._preemptiveAnswerWatchId = 0;
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
this._userVerifier.destroy();
|
|
|
86957c |
this._userVerifier = null;
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
vfunc_key_press_event(keyPressEvent) {
|
|
|
86957c |
if (keyPressEvent.keyval == Clutter.KEY_Escape)
|
|
|
86957c |
this.cancel();
|
|
|
86957c |
return super.vfunc_key_press_event(keyPressEvent);
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
- _initEntryRow() {
|
|
|
86957c |
+ _initInputRow() {
|
|
|
86957c |
this._mainBox = new St.BoxLayout({
|
|
|
86957c |
style_class: 'login-dialog-button-box',
|
|
|
86957c |
vertical: false,
|
|
|
86957c |
});
|
|
|
86957c |
this.add_child(this._mainBox);
|
|
|
86957c |
|
|
|
86957c |
this.cancelButton = new St.Button({
|
|
|
86957c |
style_class: 'modal-dialog-button button cancel-button',
|
|
|
86957c |
accessible_name: _('Cancel'),
|
|
|
86957c |
button_mask: St.ButtonMask.ONE | St.ButtonMask.THREE,
|
|
|
86957c |
reactive: this._hasCancelButton,
|
|
|
86957c |
can_focus: this._hasCancelButton,
|
|
|
86957c |
x_align: Clutter.ActorAlign.START,
|
|
|
86957c |
y_align: Clutter.ActorAlign.CENTER,
|
|
|
86957c |
child: new St.Icon({ icon_name: 'go-previous-symbolic' }),
|
|
|
86957c |
});
|
|
|
86957c |
if (this._hasCancelButton)
|
|
|
86957c |
this.cancelButton.connect('clicked', () => this.cancel());
|
|
|
86957c |
else
|
|
|
86957c |
this.cancelButton.opacity = 0;
|
|
|
86957c |
this._mainBox.add_child(this.cancelButton);
|
|
|
86957c |
|
|
|
0999a2 |
+ this._authList = new AuthList.AuthList();
|
|
|
0999a2 |
+ this._authList.set({
|
|
|
0999a2 |
+ visible: false,
|
|
|
0999a2 |
+ });
|
|
|
0999a2 |
+ this._authList.connect('activate', (list, key) => {
|
|
|
0999a2 |
+ this._authList.reactive = false;
|
|
|
0999a2 |
+ this._authList.ease({
|
|
|
0999a2 |
+ opacity: 0,
|
|
|
0999a2 |
+ duration: MESSAGE_FADE_OUT_ANIMATION_TIME,
|
|
|
0999a2 |
+ mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
|
|
0999a2 |
+ onComplete: () => {
|
|
|
0999a2 |
+ this._authList.clear();
|
|
|
0999a2 |
+ this._authList.hide();
|
|
|
0999a2 |
+ this._userVerifier.selectChoice(this._queryingService, key);
|
|
|
0999a2 |
+ },
|
|
|
0999a2 |
+ });
|
|
|
0999a2 |
+ });
|
|
|
86957c |
+ this._mainBox.add_child(this._authList);
|
|
|
0999a2 |
+
|
|
|
86957c |
let entryParams = {
|
|
|
86957c |
style_class: 'login-dialog-prompt-entry',
|
|
|
86957c |
can_focus: true,
|
|
|
86957c |
x_expand: true,
|
|
|
86957c |
};
|
|
|
86957c |
|
|
|
86957c |
this._entry = null;
|
|
|
86957c |
|
|
|
86957c |
this._textEntry = new St.Entry(entryParams);
|
|
|
86957c |
ShellEntry.addContextMenu(this._textEntry, { actionMode: Shell.ActionMode.NONE });
|
|
|
86957c |
|
|
|
86957c |
this._passwordEntry = new St.PasswordEntry(entryParams);
|
|
|
86957c |
ShellEntry.addContextMenu(this._passwordEntry, { actionMode: Shell.ActionMode.NONE });
|
|
|
86957c |
|
|
|
86957c |
this._entry = this._passwordEntry;
|
|
|
86957c |
this._mainBox.add_child(this._entry);
|
|
|
86957c |
this._entry.grab_key_focus();
|
|
|
86957c |
|
|
|
86957c |
this._timedLoginIndicator = new St.Bin({
|
|
|
86957c |
style_class: 'login-dialog-timed-login-indicator',
|
|
|
86957c |
scale_x: 0,
|
|
|
86957c |
});
|
|
|
86957c |
|
|
|
86957c |
this.add_child(this._timedLoginIndicator);
|
|
|
86957c |
|
|
|
86957c |
[this._textEntry, this._passwordEntry].forEach(entry => {
|
|
|
86957c |
entry.clutter_text.connect('text-changed', () => {
|
|
|
86957c |
if (!this._userVerifier.hasPendingMessages && this._queryingService && !this._preemptiveAnswer)
|
|
|
86957c |
this._fadeOutMessage();
|
|
|
86957c |
});
|
|
|
86957c |
@@ -276,60 +297,74 @@ var AuthPrompt = GObject.registerClass({
|
|
|
86957c |
this._entry = this._textEntry;
|
|
|
86957c |
}
|
|
|
86957c |
this._capsLockWarningLabel.visible = secret;
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
_onAskQuestion(verifier, serviceName, question, secret) {
|
|
|
86957c |
if (this._queryingService)
|
|
|
86957c |
this.clear();
|
|
|
86957c |
|
|
|
86957c |
this._queryingService = serviceName;
|
|
|
86957c |
if (this._preemptiveAnswer) {
|
|
|
86957c |
this._userVerifier.answerQuery(this._queryingService, this._preemptiveAnswer);
|
|
|
86957c |
this._preemptiveAnswer = null;
|
|
|
86957c |
return;
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
this._updateEntry(secret);
|
|
|
86957c |
|
|
|
86957c |
// Hack: The question string comes directly from PAM, if it's "Password:"
|
|
|
86957c |
// we replace it with our own to allow localization, if it's something
|
|
|
86957c |
// else we remove the last colon and any trailing or leading spaces.
|
|
|
86957c |
if (question === 'Password:' || question === 'Password: ')
|
|
|
86957c |
this.setQuestion(_('Password'));
|
|
|
86957c |
else
|
|
|
86957c |
this.setQuestion(question.replace(/: *$/, '').trim());
|
|
|
86957c |
|
|
|
86957c |
this.updateSensitivity(true);
|
|
|
0999a2 |
this.emit('prompted');
|
|
|
0999a2 |
}
|
|
|
0999a2 |
|
|
|
0999a2 |
+ _onShowChoiceList(userVerifier, serviceName, promptMessage, choiceList) {
|
|
|
0999a2 |
+ if (this._queryingService)
|
|
|
0999a2 |
+ this.clear();
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ this._queryingService = serviceName;
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ if (this._preemptiveAnswer)
|
|
|
0999a2 |
+ this._preemptiveAnswer = null;
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ this.setChoiceList(promptMessage, choiceList);
|
|
|
0999a2 |
+ this.updateSensitivity(true);
|
|
|
0999a2 |
+ this.emit('prompted');
|
|
|
0999a2 |
+ }
|
|
|
0999a2 |
+
|
|
|
0999a2 |
_onCredentialManagerAuthenticated() {
|
|
|
0999a2 |
if (this.verificationStatus != AuthPromptStatus.VERIFICATION_SUCCEEDED)
|
|
|
0999a2 |
this.reset();
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
_onSmartcardStatusChanged() {
|
|
|
86957c |
this.smartcardDetected = this._userVerifier.smartcardDetected;
|
|
|
86957c |
|
|
|
86957c |
// Most of the time we want to reset if the user inserts or removes
|
|
|
86957c |
// a smartcard. Smartcard insertion "preempts" what the user was
|
|
|
86957c |
// doing, and smartcard removal aborts the preemption.
|
|
|
86957c |
// The exceptions are: 1) Don't reset on smartcard insertion if we're already verifying
|
|
|
86957c |
// with a smartcard
|
|
|
86957c |
// 2) Don't reset if we've already succeeded at verification and
|
|
|
86957c |
// the user is getting logged in.
|
|
|
86957c |
if (this._userVerifier.serviceIsDefault(GdmUtil.SMARTCARD_SERVICE_NAME) &&
|
|
|
86957c |
this.verificationStatus == AuthPromptStatus.VERIFYING &&
|
|
|
86957c |
this.smartcardDetected)
|
|
|
86957c |
return;
|
|
|
86957c |
|
|
|
86957c |
if (this.verificationStatus != AuthPromptStatus.VERIFICATION_SUCCEEDED)
|
|
|
86957c |
this.reset();
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
_onShowMessage(_userVerifier, serviceName, message, type) {
|
|
|
86957c |
this.setMessage(serviceName, message, type);
|
|
|
86957c |
this.emit('prompted');
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
_onVerificationFailed(userVerifier, serviceName, canRetry) {
|
|
|
86957c |
@@ -411,109 +446,141 @@ var AuthPrompt = GObject.registerClass({
|
|
|
86957c |
if (actor) {
|
|
|
86957c |
if (isSpinner)
|
|
|
86957c |
this._spinner.play();
|
|
|
86957c |
|
|
|
86957c |
if (!animate) {
|
|
|
86957c |
actor.opacity = 255;
|
|
|
86957c |
} else {
|
|
|
86957c |
actor.ease({
|
|
|
86957c |
opacity: 255,
|
|
|
86957c |
duration: DEFAULT_BUTTON_WELL_ANIMATION_TIME,
|
|
|
86957c |
delay: DEFAULT_BUTTON_WELL_ANIMATION_DELAY,
|
|
|
86957c |
mode: Clutter.AnimationMode.LINEAR,
|
|
|
86957c |
});
|
|
|
86957c |
}
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
this._defaultButtonWellActor = actor;
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
startSpinning() {
|
|
|
86957c |
this.setActorInDefaultButtonWell(this._spinner, true);
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
stopSpinning() {
|
|
|
86957c |
this.setActorInDefaultButtonWell(null, false);
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
0999a2 |
clear() {
|
|
|
0999a2 |
this._entry.text = '';
|
|
|
0999a2 |
this.stopSpinning();
|
|
|
0999a2 |
+ this._authList.clear();
|
|
|
0999a2 |
+ this._authList.hide();
|
|
|
0999a2 |
}
|
|
|
0999a2 |
|
|
|
0999a2 |
setQuestion(question) {
|
|
|
86957c |
if (this._preemptiveAnswerWatchId) {
|
|
|
86957c |
this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId);
|
|
|
86957c |
this._preemptiveAnswerWatchId = 0;
|
|
|
86957c |
}
|
|
|
0999a2 |
|
|
|
0999a2 |
this._entry.hint_text = question;
|
|
|
0999a2 |
|
|
|
0999a2 |
+ this._authList.hide();
|
|
|
0999a2 |
this._entry.show();
|
|
|
0999a2 |
this._entry.grab_key_focus();
|
|
|
0999a2 |
}
|
|
|
0999a2 |
|
|
|
0999a2 |
+ _fadeInChoiceList() {
|
|
|
0999a2 |
+ this._authList.set({
|
|
|
0999a2 |
+ opacity: 0,
|
|
|
0999a2 |
+ visible: true,
|
|
|
0999a2 |
+ reactive: false,
|
|
|
0999a2 |
+ });
|
|
|
0999a2 |
+ this._authList.ease({
|
|
|
0999a2 |
+ opacity: 255,
|
|
|
0999a2 |
+ duration: MESSAGE_FADE_OUT_ANIMATION_TIME,
|
|
|
0999a2 |
+ transition: Clutter.AnimationMode.EASE_OUT_QUAD,
|
|
|
0999a2 |
+ onComplete: () => (this._authList.reactive = true),
|
|
|
0999a2 |
+ });
|
|
|
0999a2 |
+ }
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ setChoiceList(promptMessage, choiceList) {
|
|
|
0999a2 |
+ this._authList.clear();
|
|
|
0999a2 |
+ this._authList.label.text = promptMessage;
|
|
|
0999a2 |
+ for (let key in choiceList) {
|
|
|
0999a2 |
+ let text = choiceList[key];
|
|
|
0999a2 |
+ this._authList.addItem(key, text);
|
|
|
0999a2 |
+ }
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ this._entry.hide();
|
|
|
86957c |
+ if (this._message.text === '')
|
|
|
0999a2 |
+ this._message.hide();
|
|
|
0999a2 |
+ this._fadeInChoiceList();
|
|
|
0999a2 |
+ }
|
|
|
0999a2 |
+
|
|
|
0999a2 |
getAnswer() {
|
|
|
0999a2 |
let text;
|
|
|
0999a2 |
|
|
|
86957c |
if (this._preemptiveAnswer) {
|
|
|
86957c |
text = this._preemptiveAnswer;
|
|
|
86957c |
this._preemptiveAnswer = null;
|
|
|
86957c |
} else {
|
|
|
86957c |
text = this._entry.get_text();
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
return text;
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
_fadeOutMessage() {
|
|
|
86957c |
if (this._message.opacity == 0)
|
|
|
86957c |
return;
|
|
|
86957c |
this._message.remove_all_transitions();
|
|
|
86957c |
this._message.ease({
|
|
|
86957c |
opacity: 0,
|
|
|
86957c |
duration: MESSAGE_FADE_OUT_ANIMATION_TIME,
|
|
|
86957c |
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
|
|
86957c |
});
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
setMessage(serviceName, message, type) {
|
|
|
86957c |
if (type == GdmUtil.MessageType.ERROR)
|
|
|
86957c |
this._message.add_style_class_name('login-dialog-message-warning');
|
|
|
86957c |
else
|
|
|
86957c |
this._message.remove_style_class_name('login-dialog-message-warning');
|
|
|
86957c |
|
|
|
86957c |
if (type == GdmUtil.MessageType.HINT)
|
|
|
86957c |
this._message.add_style_class_name('login-dialog-message-hint');
|
|
|
0999a2 |
else
|
|
|
0999a2 |
this._message.remove_style_class_name('login-dialog-message-hint');
|
|
|
0999a2 |
|
|
|
0999a2 |
+ this._message.show();
|
|
|
0999a2 |
if (message) {
|
|
|
0999a2 |
this._message.remove_all_transitions();
|
|
|
0999a2 |
this._message.text = message;
|
|
|
86957c |
this._message.opacity = 255;
|
|
|
86957c |
} else {
|
|
|
86957c |
this._message.opacity = 0;
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
if (type === GdmUtil.MessageType.ERROR &&
|
|
|
86957c |
this._userVerifier.serviceIsFingerprint(serviceName)) {
|
|
|
86957c |
// TODO: Use Await for wiggle to be over before unfreezing the user verifier queue
|
|
|
86957c |
const wiggleParameters = {
|
|
|
86957c |
duration: 65,
|
|
|
86957c |
wiggleCount: 3,
|
|
|
86957c |
};
|
|
|
86957c |
this._userVerifier.increaseCurrentMessageTimeout(
|
|
|
86957c |
wiggleParameters.duration * (wiggleParameters.wiggleCount + 2));
|
|
|
86957c |
Util.wiggle(this._message, wiggleParameters);
|
|
|
86957c |
}
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
updateSensitivity(sensitive) {
|
|
|
86957c |
if (this._entry.reactive === sensitive)
|
|
|
86957c |
return;
|
|
|
86957c |
|
|
|
86957c |
this._entry.reactive = sensitive;
|
|
|
86957c |
|
|
|
86957c |
if (sensitive) {
|
|
|
86957c |
this._entry.grab_key_focus();
|
|
|
86957c |
} else {
|
|
|
0999a2 |
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
|
|
|
0999a2 |
index d2a82b43d..41dd99646 100644
|
|
|
0999a2 |
--- a/js/gdm/loginDialog.js
|
|
|
0999a2 |
+++ b/js/gdm/loginDialog.js
|
|
|
86957c |
@@ -391,60 +391,65 @@ var SessionMenuButton = GObject.registerClass({
|
|
|
86957c |
let item = new PopupMenu.PopupMenuItem(sessionName);
|
|
|
86957c |
this._menu.addMenuItem(item);
|
|
|
86957c |
this._items[id] = item;
|
|
|
86957c |
|
|
|
86957c |
item.connect('activate', () => {
|
|
|
86957c |
this.setActiveSession(id);
|
|
|
86957c |
this.emit('session-activated', this._activeSessionId);
|
|
|
86957c |
});
|
|
|
86957c |
}
|
|
|
86957c |
}
|
|
|
86957c |
});
|
|
|
86957c |
|
|
|
86957c |
var LoginDialog = GObject.registerClass({
|
|
|
86957c |
Signals: {
|
|
|
86957c |
'failed': {},
|
|
|
86957c |
'wake-up-screen': {},
|
|
|
86957c |
},
|
|
|
86957c |
}, class LoginDialog extends St.Widget {
|
|
|
86957c |
_init(parentActor) {
|
|
|
86957c |
super._init({ style_class: 'login-dialog', visible: false });
|
|
|
86957c |
|
|
|
86957c |
this.get_accessible().set_role(Atk.Role.WINDOW);
|
|
|
86957c |
|
|
|
86957c |
this.add_constraint(new Layout.MonitorConstraint({ primary: true }));
|
|
|
86957c |
this.connect('destroy', this._onDestroy.bind(this));
|
|
|
86957c |
parentActor.add_child(this);
|
|
|
86957c |
|
|
|
0999a2 |
this._userManager = AccountsService.UserManager.get_default();
|
|
|
0999a2 |
this._gdmClient = new Gdm.Client();
|
|
|
0999a2 |
|
|
|
0999a2 |
+ try {
|
|
|
0999a2 |
+ this._gdmClient.set_enabled_extensions([Gdm.UserVerifierChoiceList.interface_info().name]);
|
|
|
0999a2 |
+ } catch (e) {
|
|
|
0999a2 |
+ }
|
|
|
0999a2 |
+
|
|
|
0999a2 |
this._settings = new Gio.Settings({ schema_id: GdmUtil.LOGIN_SCREEN_SCHEMA });
|
|
|
0999a2 |
|
|
|
0999a2 |
this._settings.connect('changed::%s'.format(GdmUtil.BANNER_MESSAGE_KEY),
|
|
|
86957c |
this._updateBanner.bind(this));
|
|
|
86957c |
this._settings.connect('changed::%s'.format(GdmUtil.BANNER_MESSAGE_TEXT_KEY),
|
|
|
86957c |
this._updateBanner.bind(this));
|
|
|
86957c |
this._settings.connect('changed::%s'.format(GdmUtil.DISABLE_USER_LIST_KEY),
|
|
|
86957c |
this._updateDisableUserList.bind(this));
|
|
|
86957c |
this._settings.connect('changed::%s'.format(GdmUtil.LOGO_KEY),
|
|
|
86957c |
this._updateLogo.bind(this));
|
|
|
86957c |
|
|
|
86957c |
this._textureCache = St.TextureCache.get_default();
|
|
|
86957c |
this._updateLogoTextureId = this._textureCache.connect('texture-file-changed',
|
|
|
86957c |
this._updateLogoTexture.bind(this));
|
|
|
86957c |
|
|
|
86957c |
this._userSelectionBox = new St.BoxLayout({ style_class: 'login-dialog-user-selection-box',
|
|
|
86957c |
x_align: Clutter.ActorAlign.CENTER,
|
|
|
86957c |
y_align: Clutter.ActorAlign.CENTER,
|
|
|
86957c |
vertical: true,
|
|
|
86957c |
visible: false });
|
|
|
86957c |
this.add_child(this._userSelectionBox);
|
|
|
86957c |
|
|
|
86957c |
this._userList = new UserList();
|
|
|
86957c |
this._userSelectionBox.add_child(this._userList);
|
|
|
86957c |
|
|
|
86957c |
this._authPrompt = new AuthPrompt.AuthPrompt(this._gdmClient, AuthPrompt.AuthPromptMode.UNLOCK_OR_LOG_IN);
|
|
|
86957c |
this._authPrompt.connect('prompted', this._onPrompted.bind(this));
|
|
|
86957c |
this._authPrompt.connect('reset', this._onReset.bind(this));
|
|
|
86957c |
this._authPrompt.hide();
|
|
|
86957c |
this.add_child(this._authPrompt);
|
|
|
0999a2 |
diff --git a/js/gdm/util.js b/js/gdm/util.js
|
|
|
0999a2 |
index e62114cb1..3f327400f 100644
|
|
|
0999a2 |
--- a/js/gdm/util.js
|
|
|
0999a2 |
+++ b/js/gdm/util.js
|
|
|
86957c |
@@ -211,90 +211,98 @@ var ShellUserVerifier = class {
|
|
|
86957c |
this._cancellable = new Gio.Cancellable();
|
|
|
86957c |
this._hold = hold;
|
|
|
86957c |
this._userName = userName;
|
|
|
86957c |
this.reauthenticating = false;
|
|
|
86957c |
|
|
|
86957c |
this._checkForFingerprintReader();
|
|
|
86957c |
|
|
|
86957c |
// If possible, reauthenticate an already running session,
|
|
|
86957c |
// so any session specific credentials get updated appropriately
|
|
|
86957c |
if (userName)
|
|
|
86957c |
this._openReauthenticationChannel(userName);
|
|
|
86957c |
else
|
|
|
86957c |
this._getUserVerifier();
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
cancel() {
|
|
|
86957c |
if (this._cancellable)
|
|
|
86957c |
this._cancellable.cancel();
|
|
|
86957c |
|
|
|
86957c |
if (this._userVerifier) {
|
|
|
86957c |
this._userVerifier.call_cancel_sync(null);
|
|
|
86957c |
this.clear();
|
|
|
86957c |
}
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
_clearUserVerifier() {
|
|
|
86957c |
if (this._userVerifier) {
|
|
|
0999a2 |
this._disconnectSignals();
|
|
|
0999a2 |
this._userVerifier.run_dispose();
|
|
|
0999a2 |
this._userVerifier = null;
|
|
|
0999a2 |
+ if (this._userVerifierChoiceList) {
|
|
|
0999a2 |
+ this._userVerifierChoiceList.run_dispose();
|
|
|
0999a2 |
+ this._userVerifierChoiceList = null;
|
|
|
0999a2 |
+ }
|
|
|
0999a2 |
}
|
|
|
0999a2 |
}
|
|
|
0999a2 |
|
|
|
86957c |
clear() {
|
|
|
86957c |
if (this._cancellable) {
|
|
|
86957c |
this._cancellable.cancel();
|
|
|
86957c |
this._cancellable = null;
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
this._clearUserVerifier();
|
|
|
86957c |
this._clearMessageQueue();
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
destroy() {
|
|
|
86957c |
this.cancel();
|
|
|
86957c |
|
|
|
86957c |
this._settings.run_dispose();
|
|
|
86957c |
this._settings = null;
|
|
|
86957c |
|
|
|
86957c |
this._smartcardManager.disconnect(this._smartcardInsertedId);
|
|
|
86957c |
this._smartcardManager.disconnect(this._smartcardRemovedId);
|
|
|
86957c |
this._smartcardManager = null;
|
|
|
86957c |
|
|
|
86957c |
for (let service in this._credentialManagers) {
|
|
|
86957c |
let credentialManager = this._credentialManagers[service];
|
|
|
86957c |
credentialManager.disconnect(credentialManager._authenticatedSignalId);
|
|
|
86957c |
credentialManager = null;
|
|
|
0999a2 |
}
|
|
|
0999a2 |
}
|
|
|
0999a2 |
|
|
|
0999a2 |
+ selectChoice(serviceName, key) {
|
|
|
0999a2 |
+ this._userVerifierChoiceList.call_select_choice(serviceName, key, this._cancellable, null);
|
|
|
0999a2 |
+ }
|
|
|
0999a2 |
+
|
|
|
0999a2 |
answerQuery(serviceName, answer) {
|
|
|
0999a2 |
if (!this.hasPendingMessages) {
|
|
|
0999a2 |
this._userVerifier.call_answer_query(serviceName, answer, this._cancellable, null);
|
|
|
86957c |
} else {
|
|
|
86957c |
const cancellable = this._cancellable;
|
|
|
86957c |
let signalId = this.connect('no-more-messages', () => {
|
|
|
86957c |
this.disconnect(signalId);
|
|
|
86957c |
if (!cancellable.is_cancelled())
|
|
|
86957c |
this._userVerifier.call_answer_query(serviceName, answer, cancellable, null);
|
|
|
86957c |
});
|
|
|
86957c |
}
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
_getIntervalForMessage(message) {
|
|
|
86957c |
if (!message)
|
|
|
86957c |
return 0;
|
|
|
86957c |
|
|
|
86957c |
// We probably could be smarter here
|
|
|
86957c |
return message.length * USER_READ_TIME;
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
finishMessageQueue() {
|
|
|
86957c |
if (!this.hasPendingMessages)
|
|
|
86957c |
return;
|
|
|
86957c |
|
|
|
86957c |
this._messageQueue = [];
|
|
|
86957c |
|
|
|
86957c |
this.emit('no-more-messages');
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
@@ -429,103 +437,116 @@ var ShellUserVerifier = class {
|
|
|
86957c |
_reportInitError(where, error, serviceName) {
|
|
|
86957c |
logError(error, where);
|
|
|
86957c |
this._hold.release();
|
|
|
86957c |
|
|
|
86957c |
this._queueMessage(serviceName, _('Authentication error'), MessageType.ERROR);
|
|
|
86957c |
this._failCounter++;
|
|
|
86957c |
this._verificationFailed(serviceName, false);
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
async _openReauthenticationChannel(userName) {
|
|
|
86957c |
try {
|
|
|
86957c |
this._clearUserVerifier();
|
|
|
86957c |
this._userVerifier = await this._client.open_reauthentication_channel(
|
|
|
86957c |
userName, this._cancellable);
|
|
|
86957c |
} catch (e) {
|
|
|
86957c |
if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
|
|
|
86957c |
return;
|
|
|
86957c |
if (e.matches(Gio.DBusError, Gio.DBusError.ACCESS_DENIED) &&
|
|
|
86957c |
!this._reauthOnly) {
|
|
|
86957c |
// Gdm emits org.freedesktop.DBus.Error.AccessDenied when there
|
|
|
86957c |
// is no session to reauthenticate. Fall back to performing
|
|
|
86957c |
// verification from this login session
|
|
|
86957c |
this._getUserVerifier();
|
|
|
86957c |
return;
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
this._reportInitError('Failed to open reauthentication channel', e);
|
|
|
0999a2 |
return;
|
|
|
0999a2 |
}
|
|
|
0999a2 |
|
|
|
0999a2 |
+ if (this._client.get_user_verifier_choice_list)
|
|
|
0999a2 |
+ this._userVerifierChoiceList = this._client.get_user_verifier_choice_list();
|
|
|
0999a2 |
+ else
|
|
|
0999a2 |
+ this._userVerifierChoiceList = null;
|
|
|
0999a2 |
+
|
|
|
0999a2 |
this.reauthenticating = true;
|
|
|
0999a2 |
this._connectSignals();
|
|
|
0999a2 |
this._beginVerification();
|
|
|
86957c |
this._hold.release();
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
async _getUserVerifier() {
|
|
|
86957c |
try {
|
|
|
86957c |
this._clearUserVerifier();
|
|
|
86957c |
this._userVerifier =
|
|
|
86957c |
await this._client.get_user_verifier(this._cancellable);
|
|
|
86957c |
} catch (e) {
|
|
|
86957c |
if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
|
|
|
86957c |
return;
|
|
|
86957c |
this._reportInitError('Failed to obtain user verifier', e);
|
|
|
0999a2 |
return;
|
|
|
0999a2 |
}
|
|
|
0999a2 |
|
|
|
0999a2 |
+ if (this._client.get_user_verifier_choice_list)
|
|
|
0999a2 |
+ this._userVerifierChoiceList = this._client.get_user_verifier_choice_list();
|
|
|
0999a2 |
+ else
|
|
|
0999a2 |
+ this._userVerifierChoiceList = null;
|
|
|
0999a2 |
+
|
|
|
0999a2 |
this._connectSignals();
|
|
|
0999a2 |
this._beginVerification();
|
|
|
0999a2 |
this._hold.release();
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
_connectSignals() {
|
|
|
86957c |
this._disconnectSignals();
|
|
|
86957c |
this._signalIds = [];
|
|
|
86957c |
|
|
|
86957c |
let id = this._userVerifier.connect('info', this._onInfo.bind(this));
|
|
|
86957c |
this._signalIds.push(id);
|
|
|
86957c |
id = this._userVerifier.connect('problem', this._onProblem.bind(this));
|
|
|
86957c |
this._signalIds.push(id);
|
|
|
86957c |
id = this._userVerifier.connect('info-query', this._onInfoQuery.bind(this));
|
|
|
86957c |
this._signalIds.push(id);
|
|
|
86957c |
id = this._userVerifier.connect('secret-info-query', this._onSecretInfoQuery.bind(this));
|
|
|
86957c |
this._signalIds.push(id);
|
|
|
86957c |
id = this._userVerifier.connect('conversation-stopped', this._onConversationStopped.bind(this));
|
|
|
86957c |
this._signalIds.push(id);
|
|
|
86957c |
id = this._userVerifier.connect('service-unavailable', this._onServiceUnavailable.bind(this));
|
|
|
86957c |
this._signalIds.push(id);
|
|
|
86957c |
id = this._userVerifier.connect('reset', this._onReset.bind(this));
|
|
|
0999a2 |
this._signalIds.push(id);
|
|
|
0999a2 |
id = this._userVerifier.connect('verification-complete', this._onVerificationComplete.bind(this));
|
|
|
0999a2 |
this._signalIds.push(id);
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ if (this._userVerifierChoiceList)
|
|
|
0999a2 |
+ this._userVerifierChoiceList.connect('choice-query', this._onChoiceListQuery.bind(this));
|
|
|
0999a2 |
}
|
|
|
0999a2 |
|
|
|
0999a2 |
_disconnectSignals() {
|
|
|
86957c |
if (!this._signalIds || !this._userVerifier)
|
|
|
86957c |
return;
|
|
|
86957c |
|
|
|
86957c |
this._signalIds.forEach(s => this._userVerifier.disconnect(s));
|
|
|
86957c |
this._signalIds = [];
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
_getForegroundService() {
|
|
|
86957c |
if (this._preemptingService)
|
|
|
86957c |
return this._preemptingService;
|
|
|
86957c |
|
|
|
86957c |
return this._defaultService;
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
serviceIsForeground(serviceName) {
|
|
|
86957c |
return serviceName == this._getForegroundService();
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
serviceIsDefault(serviceName) {
|
|
|
86957c |
return serviceName == this._defaultService;
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
serviceIsFingerprint(serviceName) {
|
|
|
86957c |
return this._fingerprintReaderType !== FingerprintReaderType.NONE &&
|
|
|
86957c |
serviceName === FINGERPRINT_SERVICE_NAME;
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
@@ -554,60 +575,67 @@ var ShellUserVerifier = class {
|
|
|
86957c |
} else {
|
|
|
86957c |
await this._userVerifier.call_begin_verification(
|
|
|
86957c |
serviceName, this._cancellable);
|
|
|
86957c |
}
|
|
|
86957c |
} catch (e) {
|
|
|
86957c |
if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
|
|
|
86957c |
return;
|
|
|
86957c |
if (!this.serviceIsForeground(serviceName)) {
|
|
|
86957c |
logError(e, 'Failed to start %s for %s'.format(serviceName, this._userName));
|
|
|
86957c |
this._hold.release();
|
|
|
86957c |
return;
|
|
|
86957c |
}
|
|
|
86957c |
this._reportInitError(this._userName
|
|
|
86957c |
? 'Failed to start %s verification for user'.format(serviceName)
|
|
|
86957c |
: 'Failed to start %s verification'.format(serviceName), e,
|
|
|
86957c |
serviceName);
|
|
|
86957c |
return;
|
|
|
86957c |
}
|
|
|
86957c |
this._hold.release();
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
_beginVerification() {
|
|
|
86957c |
this._startService(this._getForegroundService());
|
|
|
86957c |
|
|
|
86957c |
if (this._userName &&
|
|
|
86957c |
this._fingerprintReaderType !== FingerprintReaderType.NONE &&
|
|
|
86957c |
!this.serviceIsForeground(FINGERPRINT_SERVICE_NAME))
|
|
|
0999a2 |
this._startService(FINGERPRINT_SERVICE_NAME);
|
|
|
0999a2 |
}
|
|
|
0999a2 |
|
|
|
0999a2 |
+ _onChoiceListQuery(client, serviceName, promptMessage, list) {
|
|
|
0999a2 |
+ if (!this.serviceIsForeground(serviceName))
|
|
|
0999a2 |
+ return;
|
|
|
0999a2 |
+
|
|
|
0999a2 |
+ this.emit('show-choice-list', serviceName, promptMessage, list.deep_unpack());
|
|
|
0999a2 |
+ }
|
|
|
0999a2 |
+
|
|
|
0999a2 |
_onInfo(client, serviceName, info) {
|
|
|
0999a2 |
if (this.serviceIsForeground(serviceName)) {
|
|
|
0999a2 |
this._queueMessage(serviceName, info, MessageType.INFO);
|
|
|
86957c |
} else if (this.serviceIsFingerprint(serviceName)) {
|
|
|
86957c |
// We don't show fingerprint messages directly since it's
|
|
|
86957c |
// not the main auth service. Instead we use the messages
|
|
|
86957c |
// as a cue to display our own message.
|
|
|
86957c |
if (this._fingerprintReaderType === FingerprintReaderType.SWIPE) {
|
|
|
86957c |
// Translators: this message is shown below the password entry field
|
|
|
86957c |
// to indicate the user can swipe their finger on the fingerprint reader
|
|
|
86957c |
this._queueMessage(serviceName, _('(or swipe finger across reader)'),
|
|
|
86957c |
MessageType.HINT);
|
|
|
86957c |
} else {
|
|
|
86957c |
// Translators: this message is shown below the password entry field
|
|
|
86957c |
// to indicate the user can place their finger on the fingerprint reader instead
|
|
|
86957c |
this._queueMessage(serviceName, _('(or place finger on reader)'),
|
|
|
86957c |
MessageType.HINT);
|
|
|
86957c |
}
|
|
|
86957c |
}
|
|
|
86957c |
}
|
|
|
86957c |
|
|
|
86957c |
_onProblem(client, serviceName, problem) {
|
|
|
86957c |
const isFingerprint = this.serviceIsFingerprint(serviceName);
|
|
|
86957c |
|
|
|
86957c |
if (!this.serviceIsForeground(serviceName) && !isFingerprint)
|
|
|
86957c |
return;
|
|
|
86957c |
|
|
|
86957c |
this._queuePriorityMessage(serviceName, problem, MessageType.ERROR);
|
|
|
86957c |
|
|
|
86957c |
if (isFingerprint) {
|
|
|
0999a2 |
diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js
|
|
|
86957c |
index 5b55cb08a..f4655b25b 100644
|
|
|
0999a2 |
--- a/js/ui/unlockDialog.js
|
|
|
0999a2 |
+++ b/js/ui/unlockDialog.js
|
|
|
86957c |
@@ -466,60 +466,67 @@ class UnlockDialogLayout extends Clutter.LayoutManager {
|
|
|
86957c |
else
|
|
|
86957c |
actorBox.x1 = box.x2 - (natWidth * 2);
|
|
|
86957c |
|
|
|
86957c |
actorBox.y1 = box.y2 - (natHeight * 2);
|
|
|
86957c |
actorBox.x2 = actorBox.x1 + natWidth;
|
|
|
86957c |
actorBox.y2 = actorBox.y1 + natHeight;
|
|
|
86957c |
|
|
|
86957c |
this._switchUserButton.allocate(actorBox);
|
|
|
86957c |
}
|
|
|
86957c |
}
|
|
|
86957c |
});
|
|
|
86957c |
|
|
|
86957c |
var UnlockDialog = GObject.registerClass({
|
|
|
86957c |
Signals: {
|
|
|
86957c |
'failed': {},
|
|
|
86957c |
'wake-up-screen': {},
|
|
|
86957c |
},
|
|
|
86957c |
}, class UnlockDialog extends St.Widget {
|
|
|
86957c |
_init(parentActor) {
|
|
|
86957c |
super._init({
|
|
|
86957c |
accessible_role: Atk.Role.WINDOW,
|
|
|
86957c |
style_class: 'unlock-dialog',
|
|
|
86957c |
visible: false,
|
|
|
86957c |
reactive: true,
|
|
|
86957c |
});
|
|
|
86957c |
|
|
|
86957c |
parentActor.add_child(this);
|
|
|
0999a2 |
|
|
|
0999a2 |
this._gdmClient = new Gdm.Client();
|
|
|
0999a2 |
|
|
|
0999a2 |
+ try {
|
|
|
0999a2 |
+ this._gdmClient.set_enabled_extensions([
|
|
|
0999a2 |
+ Gdm.UserVerifierChoiceList.interface_info().name,
|
|
|
0999a2 |
+ ]);
|
|
|
0999a2 |
+ } catch (e) {
|
|
|
0999a2 |
+ }
|
|
|
0999a2 |
+
|
|
|
0999a2 |
this._adjustment = new St.Adjustment({
|
|
|
0999a2 |
actor: this,
|
|
|
0999a2 |
lower: 0,
|
|
|
86957c |
upper: 2,
|
|
|
86957c |
page_size: 1,
|
|
|
86957c |
page_increment: 1,
|
|
|
86957c |
});
|
|
|
86957c |
this._adjustment.connect('notify::value', () => {
|
|
|
86957c |
this._setTransitionProgress(this._adjustment.value);
|
|
|
86957c |
});
|
|
|
86957c |
|
|
|
86957c |
this._swipeTracker = new SwipeTracker.SwipeTracker(this,
|
|
|
86957c |
Clutter.Orientation.VERTICAL,
|
|
|
86957c |
Shell.ActionMode.UNLOCK_SCREEN);
|
|
|
86957c |
this._swipeTracker.connect('begin', this._swipeBegin.bind(this));
|
|
|
86957c |
this._swipeTracker.connect('update', this._swipeUpdate.bind(this));
|
|
|
86957c |
this._swipeTracker.connect('end', this._swipeEnd.bind(this));
|
|
|
86957c |
|
|
|
86957c |
this.connect('scroll-event', (o, event) => {
|
|
|
86957c |
if (this._swipeTracker.canHandleScrollEvent(event))
|
|
|
86957c |
return Clutter.EVENT_PROPAGATE;
|
|
|
86957c |
|
|
|
86957c |
let direction = event.get_scroll_direction();
|
|
|
86957c |
if (direction === Clutter.ScrollDirection.UP)
|
|
|
86957c |
this._showClock();
|
|
|
86957c |
else if (direction === Clutter.ScrollDirection.DOWN)
|
|
|
86957c |
this._showPrompt();
|
|
|
86957c |
return Clutter.EVENT_STOP;
|
|
|
86957c |
});
|
|
|
86957c |
|
|
|
0999a2 |
--
|
|
|
86957c |
2.34.1
|
|
|
0999a2 |
|