[gnome-shell/wip/smartcard: 9/16] authPrompt: add support for auth without username
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/smartcard: 9/16] authPrompt: add support for auth without username
- Date: Mon, 29 Jul 2013 21:37:12 +0000 (UTC)
commit b14f3f434ae051aac52505862e17928fd5ece420
Author: Ray Strode <rstrode redhat com>
Date: Sun Jul 28 17:49:50 2013 -0400
authPrompt: add support for auth without username
This commit introduces a new BeginRequestType enum which gets
passed to the 'call-begin-when-ready' signal to specify whether
a username should be provided to the begin() method and changes
the loginDialog to comply.
Currently, the signal only ever gets emitted with
AuthPrompt.BeginRequestType.PROVIDE_USERNAME
but that will change in the future when providing smartcard
support.
js/gdm/authPrompt.js | 7 ++++++-
js/gdm/loginDialog.js | 32 +++++++++++++++++++++++---------
js/ui/unlockDialog.js | 16 ++++++++++++++--
3 files changed, 43 insertions(+), 12 deletions(-)
---
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
index 1c6719e..5456ee9 100644
--- a/js/gdm/authPrompt.js
+++ b/js/gdm/authPrompt.js
@@ -31,6 +31,11 @@ const AuthPromptStatus = {
VERIFICATION_SUCCEEDED: 3
};
+const BeginRequestType = {
+ PROVIDE_USERNAME: 0,
+ DONT_PROVIDE_USERNAME: 1
+};
+
const AuthPrompt = new Lang.Class({
Name: 'AuthPrompt',
@@ -423,7 +428,7 @@ const AuthPrompt = new Lang.Class({
if (oldStatus == AuthPromptStatus.VERIFICATION_FAILED)
this.emit('failed');
- this.emit('reset');
+ this.emit('reset', BeginRequestType.PROVIDE_USERNAME);
},
addCharacter: function(unichar) {
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
index 618c195..e662719 100644
--- a/js/gdm/loginDialog.js
+++ b/js/gdm/loginDialog.js
@@ -478,7 +478,7 @@ const LoginDialog = new Lang.Class({
this._notListedButton.connect('clicked',
Lang.bind(this, function() {
this._authPrompt.cancelButton.show();
- this._hideUserListAndLogIn();
+ this._hideUserListAskForUsernameAndBeginVerification();
}));
this._notListedButton.hide();
@@ -577,16 +577,21 @@ const LoginDialog = new Lang.Class({
this._showPrompt();
},
- _onReset: function() {
+ _onReset: function(authPrompt, beginRequest) {
this._sessionMenuButton.updateSensitivity(true);
this._user = null;
- if (this._disableUserList) {
- this._authPrompt.cancelButton.hide();
- this._hideUserListAndLogIn();
+ if (beginRequest == AuthPrompt.BeginRequestType.PROVIDE_USERNAME) {
+ if (this._disableUserList) {
+ this._authPrompt.cancelButton.hide();
+ this._hideUserListAskForUsernameAndBeginVerification();
+ } else {
+ this._showUserList();
+ }
} else {
- this._showUserList();
+ this._authPrompt.cancelButton.hide();
+ this._hideUserListAndBeginVerification();
}
},
@@ -631,7 +636,7 @@ const LoginDialog = new Lang.Class({
this._authPrompt.setHint(_("(e.g., user or %s)").format(hint));
},
- _askForUsernameAndLogIn: function() {
+ _askForUsernameAndBeginVerification: function() {
this._authPrompt.setPasswordChar('');
this._authPrompt.setQuestion(_("Username: "));
@@ -814,11 +819,20 @@ const LoginDialog = new Lang.Class({
this._userSelectionBox.visible = expanded;
},
- _hideUserListAndLogIn: function() {
+ _hideUserList: function() {
this._setUserListExpanded(false);
if (this._userSelectionBox.visible)
GdmUtil.cloneAndFadeOutActor(this._userSelectionBox);
- this._askForUsernameAndLogIn();
+ },
+
+ _hideUserListAskForUsernameAndBeginVerification: function() {
+ this._hideUserList();
+ this._askForUsernameAndBeginVerification();
+ },
+
+ _hideUserListAndBeginVerification: function() {
+ this._hideUserList();
+ this._authPrompt.begin();
},
_showUserList: function() {
diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js
index 8f30d6e..13a2bd4 100644
--- a/js/ui/unlockDialog.js
+++ b/js/ui/unlockDialog.js
@@ -51,7 +51,7 @@ const UnlockDialog = new Lang.Class({
this._authPrompt = new AuthPrompt.AuthPrompt(new Gdm.Client(),
AuthPrompt.AuthPromptMode.UNLOCK_ONLY);
this._authPrompt.connect('failed', Lang.bind(this, this._fail));
this._authPrompt.connect('cancelled', Lang.bind(this, this._fail));
- this._authPrompt.setUser(this._user);
+ this._authPrompt.connect('reset', Lang.bind(this, this._onReset));
this._authPrompt.setPasswordChar('\u25cf');
this._authPrompt.nextButton.label = _("Unlock");
@@ -75,7 +75,7 @@ const UnlockDialog = new Lang.Class({
this._otherUserButton = null;
}
- this._authPrompt.begin({ userName: this._userName });
+ this._authPrompt.reset();
this._updateSensitivity(true);
Main.ctrlAltTabManager.addGroup(this.actor, _("Unlock Window"), 'dialog-password-symbolic');
@@ -97,6 +97,18 @@ const UnlockDialog = new Lang.Class({
this.emit('failed');
},
+ _onReset: function(authPrompt, beginRequest) {
+ let userName;
+ if (beginRequest == AuthPrompt.BeginRequestType.PROVIDE_USERNAME) {
+ this._authPrompt.setUser(this._user);
+ userName = this._userName;
+ } else {
+ userName = null;
+ }
+
+ this._authPrompt.begin({ userName: userName });
+ },
+
_escape: function() {
if (this.allowCancel)
this._authPrompt.cancel();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]