2019-11-05 19:43:42 +00:00
|
|
|
From c3ab03f8721ea96df6ac91c0393ed13ba750ab7e Mon Sep 17 00:00:00 2001
|
2019-05-07 12:23:00 +00:00
|
|
|
From: Ray Strode <rstrode@redhat.com>
|
|
|
|
Date: Mon, 17 Jul 2017 16:48:03 -0400
|
|
|
|
Subject: [PATCH 2/2] gdmUtil: enable support for GDM's ChoiceList PAM
|
|
|
|
extension
|
|
|
|
|
|
|
|
This commit hooks up support for GDM's ChoiceList PAM extension.
|
|
|
|
---
|
|
|
|
js/gdm/authPrompt.js | 74 ++++++++++++++++++++++++++++++++++++++++++-
|
|
|
|
js/gdm/loginDialog.js | 5 +++
|
|
|
|
js/gdm/util.js | 28 ++++++++++++++++
|
|
|
|
js/ui/unlockDialog.js | 9 +++++-
|
|
|
|
4 files changed, 114 insertions(+), 2 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
|
2019-11-05 19:43:42 +00:00
|
|
|
index cf77b3f26..71069e93b 100644
|
2019-05-07 12:23:00 +00:00
|
|
|
--- a/js/gdm/authPrompt.js
|
|
|
|
+++ b/js/gdm/authPrompt.js
|
2019-11-05 19:43:42 +00:00
|
|
|
@@ -4,6 +4,7 @@ const { Clutter, GLib, Pango, Shell, St } = imports.gi;
|
|
|
|
const Signals = imports.signals;
|
2019-05-07 12:23:00 +00:00
|
|
|
|
|
|
|
const Animation = imports.ui.animation;
|
|
|
|
+const AuthList = imports.gdm.authList;
|
|
|
|
const Batch = imports.gdm.batch;
|
|
|
|
const GdmUtil = imports.gdm.util;
|
|
|
|
const Meta = imports.gi.Meta;
|
2019-11-05 19:43:42 +00:00
|
|
|
@@ -54,6 +55,7 @@ var AuthPrompt = class {
|
2019-05-07 12:23:00 +00:00
|
|
|
|
|
|
|
this._userVerifier.connect('ask-question', this._onAskQuestion.bind(this));
|
|
|
|
this._userVerifier.connect('show-message', this._onShowMessage.bind(this));
|
|
|
|
+ this._userVerifier.connect('show-choice-list', this._onShowChoiceList.bind(this));
|
|
|
|
this._userVerifier.connect('verification-failed', this._onVerificationFailed.bind(this));
|
|
|
|
this._userVerifier.connect('verification-complete', this._onVerificationComplete.bind(this));
|
|
|
|
this._userVerifier.connect('reset', this._onReset.bind(this));
|
2019-11-05 19:43:42 +00:00
|
|
|
@@ -116,6 +118,28 @@ var AuthPrompt = class {
|
2019-05-07 12:23:00 +00:00
|
|
|
|
|
|
|
this.actor.add(this._timedLoginIndicator);
|
|
|
|
|
|
|
|
+ this._authList = new AuthList.AuthList();
|
|
|
|
+ this._authList.connect('activate', (list, key) => {
|
|
|
|
+ this._authList.actor.reactive = false;
|
|
|
|
+ Tweener.addTween(this._authList.actor,
|
|
|
|
+ { opacity: 0,
|
|
|
|
+ time: MESSAGE_FADE_OUT_ANIMATION_TIME,
|
|
|
|
+ transition: 'easeOutQuad',
|
|
|
|
+ onComplete: () => {
|
|
|
|
+ this._authList.clear();
|
|
|
|
+ this._authList.actor.hide();
|
|
|
|
+ this._userVerifier.selectChoice(this._queryingService, key);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ this._authList.actor.hide();
|
|
|
|
+ this.actor.add(this._authList.actor,
|
|
|
|
+ { expand: true,
|
|
|
|
+ x_fill: true,
|
|
|
|
+ y_fill: false,
|
|
|
|
+ x_align: St.Align.START });
|
|
|
|
+
|
|
|
|
this._message = new St.Label({ opacity: 0,
|
|
|
|
styleClass: 'login-dialog-message' });
|
|
|
|
this._message.clutter_text.line_wrap = true;
|
2019-11-05 19:43:42 +00:00
|
|
|
@@ -258,6 +282,21 @@ var AuthPrompt = class {
|
2019-05-07 12:23:00 +00:00
|
|
|
this.emit('prompted');
|
2019-11-05 19:43:42 +00:00
|
|
|
}
|
2019-05-07 12:23:00 +00:00
|
|
|
|
|
|
|
+ _onShowChoiceList(userVerifier, serviceName, promptMessage, choiceList) {
|
|
|
|
+ if (this._queryingService)
|
|
|
|
+ this.clear();
|
|
|
|
+
|
|
|
|
+ this._queryingService = serviceName;
|
|
|
|
+
|
|
|
|
+ if (this._preemptiveAnswer)
|
|
|
|
+ this._preemptiveAnswer = null;
|
|
|
|
+
|
|
|
|
+ this.nextButton.label = _("Next");
|
|
|
|
+ this.setChoiceList(promptMessage, choiceList);
|
|
|
|
+ this.updateSensitivity(true);
|
|
|
|
+ this.emit('prompted');
|
2019-11-05 19:43:42 +00:00
|
|
|
+ }
|
2019-05-07 12:23:00 +00:00
|
|
|
+
|
|
|
|
_onOVirtUserAuthenticated() {
|
|
|
|
if (this.verificationStatus != AuthPromptStatus.VERIFICATION_SUCCEEDED)
|
|
|
|
this.reset();
|
2019-11-05 19:43:42 +00:00
|
|
|
@@ -386,6 +425,8 @@ var AuthPrompt = class {
|
2019-05-07 12:23:00 +00:00
|
|
|
clear() {
|
|
|
|
this._entry.text = '';
|
|
|
|
this.stopSpinning();
|
|
|
|
+ this._authList.clear();
|
|
|
|
+ this._authList.actor.hide();
|
2019-11-05 19:43:42 +00:00
|
|
|
}
|
2019-05-07 12:23:00 +00:00
|
|
|
|
|
|
|
setPasswordChar(passwordChar) {
|
2019-11-05 19:43:42 +00:00
|
|
|
@@ -401,12 +442,42 @@ var AuthPrompt = class {
|
2019-05-07 12:23:00 +00:00
|
|
|
|
|
|
|
this._label.set_text(question);
|
|
|
|
|
|
|
|
+ this._authList.actor.hide();
|
|
|
|
this._label.show();
|
|
|
|
this._entry.show();
|
|
|
|
|
|
|
|
this._entry.grab_key_focus();
|
2019-11-05 19:43:42 +00:00
|
|
|
}
|
2019-05-07 12:23:00 +00:00
|
|
|
|
|
|
|
+ _fadeInChoiceList() {
|
|
|
|
+ this._authList.actor.opacity = 0;
|
|
|
|
+ this._authList.actor.show();
|
|
|
|
+ this._authList.actor.reactive = false;
|
|
|
|
+ Tweener.addTween(this._authList.actor,
|
|
|
|
+ { opacity: 255,
|
|
|
|
+ time: MESSAGE_FADE_OUT_ANIMATION_TIME,
|
|
|
|
+ transition: 'easeOutQuad',
|
|
|
|
+ onComplete: () => {
|
|
|
|
+ this._authList.actor.reactive = true;
|
|
|
|
+ }
|
|
|
|
+ });
|
2019-11-05 19:43:42 +00:00
|
|
|
+ }
|
2019-05-07 12:23:00 +00:00
|
|
|
+
|
|
|
|
+ setChoiceList(promptMessage, choiceList) {
|
|
|
|
+ this._authList.clear();
|
|
|
|
+ this._authList.label.text = promptMessage;
|
|
|
|
+ for (let key in choiceList) {
|
|
|
|
+ let text = choiceList[key];
|
|
|
|
+ this._authList.addItem(key, text);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this._label.hide();
|
|
|
|
+ this._entry.hide();
|
|
|
|
+ if (this._message.text == "")
|
|
|
|
+ this._message.hide();
|
|
|
|
+ this._fadeInChoiceList();
|
2019-11-05 19:43:42 +00:00
|
|
|
+ }
|
2019-05-07 12:23:00 +00:00
|
|
|
+
|
|
|
|
getAnswer() {
|
|
|
|
let text;
|
|
|
|
|
2019-11-05 19:43:42 +00:00
|
|
|
@@ -442,6 +513,7 @@ var AuthPrompt = class {
|
2019-05-07 12:23:00 +00:00
|
|
|
else
|
|
|
|
this._message.remove_style_class_name('login-dialog-message-hint');
|
|
|
|
|
|
|
|
+ this._message.show();
|
|
|
|
if (message) {
|
|
|
|
Tweener.removeTweens(this._message);
|
|
|
|
this._message.text = message;
|
2019-11-05 19:43:42 +00:00
|
|
|
@@ -457,7 +529,7 @@ var AuthPrompt = class {
|
|
|
|
}
|
2019-05-07 12:23:00 +00:00
|
|
|
|
|
|
|
updateSensitivity(sensitive) {
|
|
|
|
- this._updateNextButtonSensitivity(sensitive && (this._entry.text.length > 0 || this.verificationStatus == AuthPromptStatus.VERIFYING));
|
|
|
|
+ this._updateNextButtonSensitivity(sensitive && !this._authList.actor.visible && (this._entry.text.length > 0 || this.verificationStatus == AuthPromptStatus.VERIFYING));
|
|
|
|
this._entry.reactive = sensitive;
|
|
|
|
this._entry.clutter_text.editable = sensitive;
|
2019-11-05 19:43:42 +00:00
|
|
|
}
|
2019-05-07 12:23:00 +00:00
|
|
|
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
|
2019-11-05 19:43:42 +00:00
|
|
|
index 9aaa013d8..942f5a0e5 100644
|
2019-05-07 12:23:00 +00:00
|
|
|
--- a/js/gdm/loginDialog.js
|
|
|
|
+++ b/js/gdm/loginDialog.js
|
2019-11-05 19:43:42 +00:00
|
|
|
@@ -406,6 +406,11 @@ var LoginDialog = GObject.registerClass({
|
2019-05-07 12:23:00 +00:00
|
|
|
this._userManager = AccountsService.UserManager.get_default()
|
|
|
|
this._gdmClient = new Gdm.Client();
|
|
|
|
|
|
|
|
+ try {
|
|
|
|
+ this._gdmClient.set_enabled_extensions([Gdm.UserVerifierChoiceList.interface_info().name]);
|
|
|
|
+ } catch(e) {
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
this._settings = new Gio.Settings({ schema_id: GdmUtil.LOGIN_SCREEN_SCHEMA });
|
|
|
|
|
|
|
|
this._settings.connect('changed::' + GdmUtil.BANNER_MESSAGE_KEY,
|
|
|
|
diff --git a/js/gdm/util.js b/js/gdm/util.js
|
2019-11-05 19:43:42 +00:00
|
|
|
index 6e940d2ab..9e249139d 100644
|
2019-05-07 12:23:00 +00:00
|
|
|
--- a/js/gdm/util.js
|
|
|
|
+++ b/js/gdm/util.js
|
2019-11-05 19:43:42 +00:00
|
|
|
@@ -192,6 +192,10 @@ var ShellUserVerifier = class {
|
2019-05-07 12:23:00 +00:00
|
|
|
if (this._userVerifier) {
|
|
|
|
this._userVerifier.run_dispose();
|
|
|
|
this._userVerifier = null;
|
|
|
|
+ if (this._userVerifierChoiceList) {
|
|
|
|
+ this._userVerifierChoiceList.run_dispose();
|
|
|
|
+ this._userVerifierChoiceList = null;
|
|
|
|
+ }
|
|
|
|
}
|
2019-11-05 19:43:42 +00:00
|
|
|
}
|
2019-05-07 12:23:00 +00:00
|
|
|
|
2019-11-05 19:43:42 +00:00
|
|
|
@@ -219,6 +223,10 @@ var ShellUserVerifier = class {
|
2019-05-07 12:23:00 +00:00
|
|
|
this._oVirtCredentialsManager = null;
|
2019-11-05 19:43:42 +00:00
|
|
|
}
|
2019-05-07 12:23:00 +00:00
|
|
|
|
|
|
|
+ selectChoice(serviceName, key) {
|
|
|
|
+ this._userVerifierChoiceList.call_select_choice(serviceName, key, this._cancellable, null);
|
2019-11-05 19:43:42 +00:00
|
|
|
+ }
|
2019-05-07 12:23:00 +00:00
|
|
|
+
|
|
|
|
answerQuery(serviceName, answer) {
|
|
|
|
if (!this.hasPendingMessages) {
|
|
|
|
this._userVerifier.call_answer_query(serviceName, answer, this._cancellable, null);
|
2019-11-05 19:43:42 +00:00
|
|
|
@@ -362,6 +370,11 @@ var ShellUserVerifier = class {
|
2019-05-07 12:23:00 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if (client.get_user_verifier_choice_list)
|
|
|
|
+ this._userVerifierChoiceList = client.get_user_verifier_choice_list();
|
|
|
|
+ else
|
|
|
|
+ this._userVerifierChoiceList = null;
|
|
|
|
+
|
|
|
|
this.reauthenticating = true;
|
|
|
|
this._connectSignals();
|
|
|
|
this._beginVerification();
|
2019-11-05 19:43:42 +00:00
|
|
|
@@ -379,6 +392,11 @@ var ShellUserVerifier = class {
|
2019-05-07 12:23:00 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if (client.get_user_verifier_choice_list)
|
|
|
|
+ this._userVerifierChoiceList = client.get_user_verifier_choice_list();
|
|
|
|
+ else
|
|
|
|
+ this._userVerifierChoiceList = null;
|
|
|
|
+
|
|
|
|
this._connectSignals();
|
|
|
|
this._beginVerification();
|
|
|
|
this._hold.release();
|
2019-11-05 19:43:42 +00:00
|
|
|
@@ -392,6 +410,9 @@ var ShellUserVerifier = class {
|
2019-05-07 12:23:00 +00:00
|
|
|
this._userVerifier.connect('conversation-stopped', this._onConversationStopped.bind(this));
|
|
|
|
this._userVerifier.connect('reset', this._onReset.bind(this));
|
|
|
|
this._userVerifier.connect('verification-complete', this._onVerificationComplete.bind(this));
|
|
|
|
+
|
|
|
|
+ if (this._userVerifierChoiceList)
|
|
|
|
+ this._userVerifierChoiceList.connect('choice-query', this._onChoiceListQuery.bind(this));
|
2019-11-05 19:43:42 +00:00
|
|
|
}
|
2019-05-07 12:23:00 +00:00
|
|
|
|
|
|
|
_getForegroundService() {
|
2019-11-05 19:43:42 +00:00
|
|
|
@@ -468,6 +489,13 @@ var ShellUserVerifier = class {
|
2019-05-07 12:23:00 +00:00
|
|
|
this._startService(FINGERPRINT_SERVICE_NAME);
|
2019-11-05 19:43:42 +00:00
|
|
|
}
|
2019-05-07 12:23:00 +00:00
|
|
|
|
|
|
|
+ _onChoiceListQuery(client, serviceName, promptMessage, list) {
|
|
|
|
+ if (!this.serviceIsForeground(serviceName))
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ this.emit('show-choice-list', serviceName, promptMessage, list.deep_unpack());
|
2019-11-05 19:43:42 +00:00
|
|
|
+ }
|
2019-05-07 12:23:00 +00:00
|
|
|
+
|
|
|
|
_onInfo(client, serviceName, info) {
|
|
|
|
if (this.serviceIsForeground(serviceName)) {
|
|
|
|
this._queueMessage(info, MessageType.INFO);
|
|
|
|
diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js
|
2019-11-05 19:43:42 +00:00
|
|
|
index 5c9d46021..4b0470f4b 100644
|
2019-05-07 12:23:00 +00:00
|
|
|
--- a/js/ui/unlockDialog.js
|
|
|
|
+++ b/js/ui/unlockDialog.js
|
2019-11-05 19:43:42 +00:00
|
|
|
@@ -33,7 +33,14 @@ var UnlockDialog = class {
|
2019-05-07 12:23:00 +00:00
|
|
|
y_expand: true });
|
|
|
|
this.actor.add_child(this._promptBox);
|
|
|
|
|
|
|
|
- this._authPrompt = new AuthPrompt.AuthPrompt(new Gdm.Client(), AuthPrompt.AuthPromptMode.UNLOCK_ONLY);
|
|
|
|
+ this._gdmClient = new Gdm.Client();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ this._gdmClient.set_enabled_extensions([Gdm.UserVerifierChoiceList.interface_info().name]);
|
|
|
|
+ } catch(e) {
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this._authPrompt = new AuthPrompt.AuthPrompt(this._gdmClient, 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));
|
|
|
|
--
|
2019-11-05 19:43:42 +00:00
|
|
|
2.21.0
|
2019-05-07 12:23:00 +00:00
|
|
|
|