2011-09-28 09:16:26 -04:00
|
|
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
|
|
|
/*
|
2011-02-21 12:17:34 -05:00
|
|
|
* Copyright 2010 Red Hat, Inc
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
* 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* Author: David Zeuthen <davidz@redhat.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
const Lang = imports.lang;
|
|
|
|
const Signals = imports.signals;
|
|
|
|
const Shell = imports.gi.Shell;
|
2011-05-10 10:13:05 -04:00
|
|
|
const AccountsService = imports.gi.AccountsService;
|
2011-02-21 12:17:34 -05:00
|
|
|
const Clutter = imports.gi.Clutter;
|
|
|
|
const St = imports.gi.St;
|
|
|
|
const Pango = imports.gi.Pango;
|
2011-11-17 22:42:37 -05:00
|
|
|
const GLib = imports.gi.GLib;
|
2011-02-21 12:17:34 -05:00
|
|
|
const Gio = imports.gi.Gio;
|
|
|
|
const Mainloop = imports.mainloop;
|
|
|
|
const Polkit = imports.gi.Polkit;
|
|
|
|
const PolkitAgent = imports.gi.PolkitAgent;
|
|
|
|
|
|
|
|
const ModalDialog = imports.ui.modalDialog;
|
2011-10-11 18:38:24 -04:00
|
|
|
const ShellEntry = imports.ui.shellEntry;
|
2011-02-21 12:17:34 -05:00
|
|
|
|
2011-11-20 10:32:59 -05:00
|
|
|
const AuthenticationDialog = new Lang.Class({
|
|
|
|
Name: 'AuthenticationDialog',
|
|
|
|
Extends: ModalDialog.ModalDialog,
|
2011-02-21 12:17:34 -05:00
|
|
|
|
2011-02-23 13:34:29 -05:00
|
|
|
_init: function(actionId, message, cookie, userNames) {
|
2012-02-09 15:52:21 -05:00
|
|
|
this.parent({ styleClass: 'prompt-dialog' });
|
2011-02-21 12:17:34 -05:00
|
|
|
|
2011-02-23 13:34:29 -05:00
|
|
|
this.actionId = actionId;
|
2011-02-21 12:17:34 -05:00
|
|
|
this.message = message;
|
|
|
|
this.userNames = userNames;
|
2011-03-14 12:18:03 -04:00
|
|
|
this._wasDismissed = false;
|
|
|
|
this._completed = false;
|
2011-02-21 12:17:34 -05:00
|
|
|
|
2012-02-09 15:52:21 -05:00
|
|
|
let mainContentBox = new St.BoxLayout({ style_class: 'prompt-dialog-main-layout',
|
2011-02-21 12:17:34 -05:00
|
|
|
vertical: false });
|
|
|
|
this.contentLayout.add(mainContentBox,
|
|
|
|
{ x_fill: true,
|
|
|
|
y_fill: true });
|
|
|
|
|
|
|
|
let icon = new St.Icon({ icon_name: 'dialog-password-symbolic' });
|
|
|
|
mainContentBox.add(icon,
|
|
|
|
{ x_fill: true,
|
|
|
|
y_fill: false,
|
|
|
|
x_align: St.Align.END,
|
|
|
|
y_align: St.Align.START });
|
|
|
|
|
2012-02-09 15:52:21 -05:00
|
|
|
let messageBox = new St.BoxLayout({ style_class: 'prompt-dialog-message-layout',
|
2011-02-21 12:17:34 -05:00
|
|
|
vertical: true });
|
|
|
|
mainContentBox.add(messageBox,
|
|
|
|
{ y_align: St.Align.START });
|
|
|
|
|
2012-02-09 15:52:21 -05:00
|
|
|
this._subjectLabel = new St.Label({ style_class: 'prompt-dialog-headline',
|
2011-03-23 16:49:24 -04:00
|
|
|
text: _("Authentication Required") });
|
2011-02-21 12:17:34 -05:00
|
|
|
|
|
|
|
messageBox.add(this._subjectLabel,
|
|
|
|
{ y_fill: false,
|
|
|
|
y_align: St.Align.START });
|
|
|
|
|
2012-02-09 15:52:21 -05:00
|
|
|
this._descriptionLabel = new St.Label({ style_class: 'prompt-dialog-description',
|
2011-02-21 12:17:34 -05:00
|
|
|
text: message });
|
|
|
|
this._descriptionLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
|
|
|
this._descriptionLabel.clutter_text.line_wrap = true;
|
|
|
|
|
|
|
|
messageBox.add(this._descriptionLabel,
|
|
|
|
{ y_fill: true,
|
|
|
|
y_align: St.Align.START });
|
|
|
|
|
|
|
|
if (userNames.length > 1) {
|
|
|
|
log('polkitAuthenticationAgent: Received ' + userNames.length +
|
|
|
|
' identities that can be used for authentication. Only ' +
|
2011-11-17 22:42:37 -05:00
|
|
|
'considering one.');
|
2011-02-21 12:17:34 -05:00
|
|
|
}
|
|
|
|
|
2011-11-17 22:42:37 -05:00
|
|
|
let userName = GLib.get_user_name();
|
|
|
|
if (userNames.indexOf(userName) < 0)
|
|
|
|
userName = 'root';
|
|
|
|
if (userNames.indexOf(userName) < 0)
|
|
|
|
userName = userNames[0];
|
2011-02-21 12:17:34 -05:00
|
|
|
|
2011-05-10 10:13:05 -04:00
|
|
|
this._user = AccountsService.UserManager.get_default().get_user(userName);
|
2011-02-21 12:17:34 -05:00
|
|
|
let userRealName = this._user.get_real_name()
|
|
|
|
this._userLoadedId = this._user.connect('notify::is_loaded',
|
|
|
|
Lang.bind(this, this._onUserChanged));
|
|
|
|
this._userChangedId = this._user.connect('changed',
|
|
|
|
Lang.bind(this, this._onUserChanged));
|
|
|
|
|
|
|
|
// Special case 'root'
|
2011-03-14 12:18:03 -04:00
|
|
|
let userIsRoot = false;
|
|
|
|
if (userName == 'root') {
|
|
|
|
userIsRoot = true;
|
2011-03-23 16:49:24 -04:00
|
|
|
userRealName = _("Administrator");
|
2011-03-14 12:18:03 -04:00
|
|
|
}
|
2011-02-21 12:17:34 -05:00
|
|
|
|
2011-03-14 12:18:03 -04:00
|
|
|
if (userIsRoot) {
|
|
|
|
let userLabel = new St.Label(({ style_class: 'polkit-dialog-user-root-label',
|
|
|
|
text: userRealName }));
|
|
|
|
messageBox.add(userLabel);
|
|
|
|
} else {
|
|
|
|
let userBox = new St.BoxLayout({ style_class: 'polkit-dialog-user-layout',
|
|
|
|
vertical: false });
|
|
|
|
messageBox.add(userBox);
|
|
|
|
this._userIcon = new St.Icon();
|
|
|
|
this._userIcon.hide();
|
|
|
|
userBox.add(this._userIcon,
|
|
|
|
{ x_fill: true,
|
|
|
|
y_fill: false,
|
|
|
|
x_align: St.Align.END,
|
|
|
|
y_align: St.Align.START });
|
|
|
|
let userLabel = new St.Label(({ style_class: 'polkit-dialog-user-label',
|
|
|
|
text: userRealName }));
|
|
|
|
userBox.add(userLabel,
|
|
|
|
{ x_fill: true,
|
|
|
|
y_fill: false,
|
|
|
|
x_align: St.Align.END,
|
|
|
|
y_align: St.Align.MIDDLE });
|
|
|
|
}
|
2011-02-21 12:17:34 -05:00
|
|
|
|
|
|
|
this._onUserChanged();
|
|
|
|
|
2012-08-01 16:37:31 -04:00
|
|
|
this._passwordBox = new St.BoxLayout({ vertical: false, style_class: 'prompt-dialog-password-box' });
|
2011-02-21 12:17:34 -05:00
|
|
|
messageBox.add(this._passwordBox);
|
2012-02-09 15:52:21 -05:00
|
|
|
this._passwordLabel = new St.Label(({ style_class: 'prompt-dialog-password-label' }));
|
2012-08-01 16:37:31 -04:00
|
|
|
this._passwordBox.add(this._passwordLabel, { y_fill: false, y_align: St.Align.MIDDLE });
|
2012-02-09 15:52:21 -05:00
|
|
|
this._passwordEntry = new St.Entry({ style_class: 'prompt-dialog-password-entry',
|
2011-03-24 04:01:16 -04:00
|
|
|
text: "",
|
2011-02-21 12:17:34 -05:00
|
|
|
can_focus: true});
|
2011-10-11 18:38:24 -04:00
|
|
|
ShellEntry.addContextMenu(this._passwordEntry, { isPassword: true });
|
2011-02-21 12:17:34 -05:00
|
|
|
this._passwordEntry.clutter_text.connect('activate', Lang.bind(this, this._onEntryActivate));
|
|
|
|
this._passwordBox.add(this._passwordEntry,
|
2012-08-01 16:37:31 -04:00
|
|
|
{ expand: true });
|
2011-09-15 08:04:15 -04:00
|
|
|
this.setInitialKeyFocus(this._passwordEntry);
|
2011-02-21 12:17:34 -05:00
|
|
|
this._passwordBox.hide();
|
|
|
|
|
2012-02-09 15:52:21 -05:00
|
|
|
this._errorMessageLabel = new St.Label({ style_class: 'prompt-dialog-error-label' });
|
2011-03-14 12:18:03 -04:00
|
|
|
this._errorMessageLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
|
|
|
this._errorMessageLabel.clutter_text.line_wrap = true;
|
|
|
|
messageBox.add(this._errorMessageLabel);
|
|
|
|
this._errorMessageLabel.hide();
|
|
|
|
|
2012-02-09 15:52:21 -05:00
|
|
|
this._infoMessageLabel = new St.Label({ style_class: 'prompt-dialog-info-label' });
|
2011-03-14 12:18:03 -04:00
|
|
|
this._infoMessageLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
|
|
|
this._infoMessageLabel.clutter_text.line_wrap = true;
|
|
|
|
messageBox.add(this._infoMessageLabel);
|
|
|
|
this._infoMessageLabel.hide();
|
|
|
|
|
|
|
|
/* text is intentionally non-blank otherwise the height is not the same as for
|
|
|
|
* infoMessage and errorMessageLabel - but it is still invisible because
|
|
|
|
* gnome-shell.css sets the color to be transparent
|
|
|
|
*/
|
2012-02-09 15:52:21 -05:00
|
|
|
this._nullMessageLabel = new St.Label({ style_class: 'prompt-dialog-null-label',
|
2011-03-14 12:18:03 -04:00
|
|
|
text: 'abc'});
|
2012-06-04 12:21:20 -04:00
|
|
|
this._nullMessageLabel.add_style_class_name('hidden');
|
2011-03-14 12:18:03 -04:00
|
|
|
this._nullMessageLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
|
|
|
this._nullMessageLabel.clutter_text.line_wrap = true;
|
|
|
|
messageBox.add(this._nullMessageLabel);
|
|
|
|
this._nullMessageLabel.show();
|
2011-02-21 12:17:34 -05:00
|
|
|
|
2011-03-23 16:49:24 -04:00
|
|
|
this.setButtons([{ label: _("Cancel"),
|
2011-02-21 12:17:34 -05:00
|
|
|
action: Lang.bind(this, this.cancel),
|
|
|
|
key: Clutter.Escape
|
|
|
|
},
|
2011-03-23 16:49:24 -04:00
|
|
|
{ label: _("Authenticate"),
|
2012-07-19 09:32:59 -04:00
|
|
|
action: Lang.bind(this, this._onAuthenticateButtonPressed),
|
|
|
|
default: true
|
2011-02-21 12:17:34 -05:00
|
|
|
}]);
|
|
|
|
|
|
|
|
this._doneEmitted = false;
|
|
|
|
|
|
|
|
this._identityToAuth = Polkit.UnixUser.new_for_name(userName);
|
|
|
|
this._cookie = cookie;
|
|
|
|
|
|
|
|
this._session = new PolkitAgent.Session({ identity: this._identityToAuth,
|
|
|
|
cookie: this._cookie });
|
|
|
|
this._session.connect('completed', Lang.bind(this, this._onSessionCompleted));
|
|
|
|
this._session.connect('request', Lang.bind(this, this._onSessionRequest));
|
|
|
|
this._session.connect('show-error', Lang.bind(this, this._onSessionShowError));
|
|
|
|
this._session.connect('show-info', Lang.bind(this, this._onSessionShowInfo));
|
|
|
|
},
|
|
|
|
|
2011-02-23 13:34:29 -05:00
|
|
|
startAuthentication: function() {
|
|
|
|
this._session.initiate();
|
|
|
|
},
|
|
|
|
|
|
|
|
_ensureOpen: function() {
|
|
|
|
// NOTE: ModalDialog.open() is safe to call if the dialog is
|
|
|
|
// already open - it just returns true without side-effects
|
|
|
|
if (!this.open(global.get_current_time())) {
|
|
|
|
// This can fail if e.g. unable to get input grab
|
|
|
|
//
|
|
|
|
// In an ideal world this wouldn't happen (because the
|
|
|
|
// Shell is in complete control of the session) but that's
|
|
|
|
// just not how things work right now.
|
|
|
|
//
|
|
|
|
// One way to make this happen is by running 'sleep 3;
|
|
|
|
// pkexec bash' and then opening a popup menu.
|
|
|
|
//
|
|
|
|
// We could add retrying if this turns out to be a problem
|
|
|
|
|
|
|
|
log('polkitAuthenticationAgent: Failed to show modal dialog.' +
|
|
|
|
' Dismissing authentication request for action-id ' + this.actionId +
|
|
|
|
' cookie ' + this._cookie);
|
|
|
|
this._emitDone(false, true);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2011-02-22 16:54:08 -05:00
|
|
|
_emitDone: function(keepVisible, dismissed) {
|
2011-02-21 12:17:34 -05:00
|
|
|
if (!this._doneEmitted) {
|
|
|
|
this._doneEmitted = true;
|
2011-02-22 16:54:08 -05:00
|
|
|
this.emit('done', keepVisible, dismissed);
|
2011-02-21 12:17:34 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
_onEntryActivate: function() {
|
|
|
|
let response = this._passwordEntry.get_text();
|
|
|
|
this._session.response(response);
|
|
|
|
// When the user responds, dismiss already shown info and
|
|
|
|
// error texts (if any)
|
2011-03-14 12:18:03 -04:00
|
|
|
this._errorMessageLabel.hide();
|
|
|
|
this._infoMessageLabel.hide();
|
|
|
|
this._nullMessageLabel.show();
|
2011-02-21 12:17:34 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
_onAuthenticateButtonPressed: function() {
|
|
|
|
this._onEntryActivate();
|
|
|
|
},
|
|
|
|
|
|
|
|
_onSessionCompleted: function(session, gainedAuthorization) {
|
2011-03-14 12:18:03 -04:00
|
|
|
if (this._completed)
|
|
|
|
return;
|
|
|
|
|
|
|
|
this._completed = true;
|
|
|
|
|
|
|
|
if (!gainedAuthorization) {
|
|
|
|
/* Unless we are showing an existing error message from the PAM
|
|
|
|
* module (the PAM module could be reporting the authentication
|
|
|
|
* error providing authentication-method specific information),
|
|
|
|
* show "Sorry, that didn't work. Please try again."
|
|
|
|
*/
|
|
|
|
if (!this._errorMessageLabel.visible && !this._wasDismissed) {
|
2011-03-27 01:11:54 -04:00
|
|
|
/* Translators: "that didn't work" refers to the fact that the
|
|
|
|
* requested authentication was not gained; this can happen
|
|
|
|
* because of an authentication error (like invalid password),
|
|
|
|
* for instance. */
|
2011-03-23 16:49:24 -04:00
|
|
|
this._errorMessageLabel.set_text(_("Sorry, that didn\'t work. Please try again."));
|
2011-03-14 12:18:03 -04:00
|
|
|
this._errorMessageLabel.show();
|
|
|
|
this._infoMessageLabel.hide();
|
|
|
|
this._nullMessageLabel.hide();
|
|
|
|
}
|
|
|
|
}
|
2011-02-22 16:54:08 -05:00
|
|
|
this._emitDone(!gainedAuthorization, false);
|
2011-02-21 12:17:34 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
_onSessionRequest: function(session, request, echo_on) {
|
|
|
|
// Cheap localization trick
|
2012-06-27 19:22:46 -04:00
|
|
|
if (request == 'Password:' || request == 'Password: ')
|
2011-03-23 16:49:24 -04:00
|
|
|
this._passwordLabel.set_text(_("Password:"));
|
2011-02-21 12:17:34 -05:00
|
|
|
else
|
|
|
|
this._passwordLabel.set_text(request);
|
|
|
|
|
|
|
|
if (echo_on)
|
|
|
|
this._passwordEntry.clutter_text.set_password_char('');
|
|
|
|
else
|
|
|
|
this._passwordEntry.clutter_text.set_password_char('\u25cf'); // ● U+25CF BLACK CIRCLE
|
|
|
|
|
|
|
|
this._passwordBox.show();
|
|
|
|
this._passwordEntry.set_text('');
|
|
|
|
this._passwordEntry.grab_key_focus();
|
2011-02-23 13:34:29 -05:00
|
|
|
this._ensureOpen();
|
2011-02-21 12:17:34 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
_onSessionShowError: function(session, text) {
|
|
|
|
this._passwordEntry.set_text('');
|
2011-03-14 12:18:03 -04:00
|
|
|
this._errorMessageLabel.set_text(text);
|
|
|
|
this._errorMessageLabel.show();
|
|
|
|
this._infoMessageLabel.hide();
|
|
|
|
this._nullMessageLabel.hide();
|
2011-02-23 13:34:29 -05:00
|
|
|
this._ensureOpen();
|
2011-02-21 12:17:34 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
_onSessionShowInfo: function(session, text) {
|
|
|
|
this._passwordEntry.set_text('');
|
2011-03-14 12:18:03 -04:00
|
|
|
this._infoMessageLabel.set_text(text);
|
|
|
|
this._infoMessageLabel.show();
|
|
|
|
this._errorMessageLabel.hide();
|
|
|
|
this._nullMessageLabel.hide();
|
2011-02-23 13:34:29 -05:00
|
|
|
this._ensureOpen();
|
2011-02-21 12:17:34 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
destroySession: function() {
|
|
|
|
if (this._session) {
|
2011-03-14 12:18:03 -04:00
|
|
|
if (!this._completed)
|
|
|
|
this._session.cancel();
|
2011-02-21 12:17:34 -05:00
|
|
|
this._session = null;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
_onUserChanged: function() {
|
|
|
|
if (this._user.is_loaded) {
|
2011-03-14 12:18:03 -04:00
|
|
|
if (this._userIcon) {
|
|
|
|
let iconFileName = this._user.get_icon_file();
|
|
|
|
let iconFile = Gio.file_new_for_path(iconFileName);
|
|
|
|
let icon;
|
|
|
|
if (iconFile.query_exists(null)) {
|
|
|
|
icon = new Gio.FileIcon({file: iconFile});
|
|
|
|
} else {
|
2012-08-30 16:20:19 -04:00
|
|
|
icon = new Gio.ThemedIcon({name: 'avatar-default-symbolic'});
|
2011-03-14 12:18:03 -04:00
|
|
|
}
|
|
|
|
this._userIcon.set_gicon (icon);
|
|
|
|
this._userIcon.show();
|
2011-02-21 12:17:34 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
cancel: function() {
|
2011-03-14 12:18:03 -04:00
|
|
|
this._wasDismissed = true;
|
2011-02-21 12:17:34 -05:00
|
|
|
this.close(global.get_current_time());
|
2011-02-22 16:54:08 -05:00
|
|
|
this._emitDone(false, true);
|
2011-02-21 12:17:34 -05:00
|
|
|
},
|
2011-11-20 10:32:59 -05:00
|
|
|
});
|
2011-02-21 12:17:34 -05:00
|
|
|
Signals.addSignalMethods(AuthenticationDialog.prototype);
|
|
|
|
|
2011-11-20 12:56:27 -05:00
|
|
|
const AuthenticationAgent = new Lang.Class({
|
|
|
|
Name: 'AuthenticationAgent',
|
2011-02-21 12:17:34 -05:00
|
|
|
|
|
|
|
_init: function() {
|
|
|
|
this._native = new Shell.PolkitAuthenticationAgent();
|
|
|
|
this._native.connect('initiate', Lang.bind(this, this._onInitiate));
|
|
|
|
this._native.connect('cancel', Lang.bind(this, this._onCancel));
|
|
|
|
this._currentDialog = null;
|
|
|
|
this._isCompleting = false;
|
|
|
|
},
|
|
|
|
|
|
|
|
_onInitiate: function(nativeAgent, actionId, message, iconName, cookie, userNames) {
|
2011-02-23 13:34:29 -05:00
|
|
|
this._currentDialog = new AuthenticationDialog(actionId, message, cookie, userNames);
|
|
|
|
|
|
|
|
// We actually don't want to open the dialog until we know for
|
|
|
|
// sure that we're going to interact with the user. For
|
|
|
|
// example, if the password for the identity to auth is blank
|
|
|
|
// (which it will be on a live CD) then there will be no
|
|
|
|
// conversation at all... of course, we don't *know* that
|
|
|
|
// until we actually try it.
|
|
|
|
//
|
|
|
|
// See https://bugzilla.gnome.org/show_bug.cgi?id=643062 for more
|
|
|
|
// discussion.
|
|
|
|
|
|
|
|
this._currentDialog.connect('done', Lang.bind(this, this._onDialogDone));
|
|
|
|
this._currentDialog.startAuthentication();
|
2011-02-21 12:17:34 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
_onCancel: function(nativeAgent) {
|
2011-02-22 16:54:08 -05:00
|
|
|
this._completeRequest(false, false);
|
2011-02-21 12:17:34 -05:00
|
|
|
},
|
|
|
|
|
2011-02-22 16:54:08 -05:00
|
|
|
_onDialogDone: function(dialog, keepVisible, dismissed) {
|
|
|
|
this._completeRequest(keepVisible, dismissed);
|
2011-02-21 12:17:34 -05:00
|
|
|
},
|
|
|
|
|
2011-02-22 16:54:08 -05:00
|
|
|
_reallyCompleteRequest: function(dismissed) {
|
2011-02-21 12:17:34 -05:00
|
|
|
this._currentDialog.close();
|
|
|
|
this._currentDialog.destroySession();
|
|
|
|
this._currentDialog = null;
|
|
|
|
this._isCompleting = false;
|
|
|
|
|
2011-02-22 16:54:08 -05:00
|
|
|
this._native.complete(dismissed)
|
2011-02-21 12:17:34 -05:00
|
|
|
},
|
|
|
|
|
2011-02-22 16:54:08 -05:00
|
|
|
_completeRequest: function(keepVisible, wasDismissed) {
|
2011-02-21 12:17:34 -05:00
|
|
|
if (this._isCompleting)
|
|
|
|
return;
|
|
|
|
|
|
|
|
this._isCompleting = true;
|
|
|
|
|
|
|
|
if (keepVisible) {
|
|
|
|
// Give the user 2 seconds to read 'Authentication Failure' before
|
|
|
|
// dismissing the dialog
|
|
|
|
Mainloop.timeout_add(2000,
|
|
|
|
Lang.bind(this,
|
|
|
|
function() {
|
2011-02-22 16:54:08 -05:00
|
|
|
this._reallyCompleteRequest(wasDismissed);
|
2012-01-17 06:17:34 -05:00
|
|
|
return false;
|
2011-02-21 12:17:34 -05:00
|
|
|
}));
|
|
|
|
} else {
|
2011-02-22 16:54:08 -05:00
|
|
|
this._reallyCompleteRequest(wasDismissed);
|
2011-02-21 12:17:34 -05:00
|
|
|
}
|
|
|
|
}
|
2011-11-20 12:56:27 -05:00
|
|
|
});
|
2011-02-21 12:17:34 -05:00
|
|
|
|
|
|
|
function init() {
|
|
|
|
let agent = new AuthenticationAgent();
|
|
|
|
}
|