Show a guest login prompt
This commit is contained in:
parent
74f4447b38
commit
c3ae81a5b3
@ -402,6 +402,40 @@ var SessionMenuButton = new Lang.Class({
|
|||||||
});
|
});
|
||||||
Signals.addSignalMethods(SessionMenuButton.prototype);
|
Signals.addSignalMethods(SessionMenuButton.prototype);
|
||||||
|
|
||||||
|
var GuestUser = new Lang.Class({
|
||||||
|
Name: 'GuestUser',
|
||||||
|
|
||||||
|
_init: function() {
|
||||||
|
this.is_loaded = true;
|
||||||
|
this.locked = false;
|
||||||
|
},
|
||||||
|
|
||||||
|
connect: function() {
|
||||||
|
},
|
||||||
|
disconnect: function() {
|
||||||
|
},
|
||||||
|
|
||||||
|
is_system_account: function() {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
get_icon_file: function() {
|
||||||
|
return null; // FIXME: Use an icon for guest?
|
||||||
|
},
|
||||||
|
|
||||||
|
get_real_name: function() {
|
||||||
|
return 'Guest'; // FIXME: Translatable
|
||||||
|
},
|
||||||
|
|
||||||
|
get_user_name: function() {
|
||||||
|
return '*guest'; // FIXME: No a real username...
|
||||||
|
},
|
||||||
|
|
||||||
|
is_logged_in: function() {
|
||||||
|
return false; // FIXME: Can be logged in..
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
var LoginDialog = new Lang.Class({
|
var LoginDialog = new Lang.Class({
|
||||||
Name: 'LoginDialog',
|
Name: 'LoginDialog',
|
||||||
|
|
||||||
@ -446,6 +480,8 @@ var LoginDialog = new Lang.Class({
|
|||||||
x_fill: true,
|
x_fill: true,
|
||||||
y_fill: true });
|
y_fill: true });
|
||||||
|
|
||||||
|
this._guestUser = new GuestUser();
|
||||||
|
|
||||||
this._authPrompt = new AuthPrompt.AuthPrompt(this._gdmClient, AuthPrompt.AuthPromptMode.UNLOCK_OR_LOG_IN);
|
this._authPrompt = new AuthPrompt.AuthPrompt(this._gdmClient, AuthPrompt.AuthPromptMode.UNLOCK_OR_LOG_IN);
|
||||||
this._authPrompt.connect('prompted', Lang.bind(this, this._onPrompted));
|
this._authPrompt.connect('prompted', Lang.bind(this, this._onPrompted));
|
||||||
this._authPrompt.connect('reset', Lang.bind(this, this._onReset));
|
this._authPrompt.connect('reset', Lang.bind(this, this._onReset));
|
||||||
@ -1204,6 +1240,7 @@ var LoginDialog = new Lang.Class({
|
|||||||
for (let i = 0; i < users.length; i++) {
|
for (let i = 0; i < users.length; i++) {
|
||||||
this._userList.addUser(users[i]);
|
this._userList.addUser(users[i]);
|
||||||
}
|
}
|
||||||
|
this._userList.addUser(this._guestUser);
|
||||||
|
|
||||||
this._updateDisableUserList();
|
this._updateDisableUserList();
|
||||||
|
|
||||||
|
@ -423,7 +423,21 @@ var ShellUserVerifier = new Lang.Class({
|
|||||||
|
|
||||||
_startService: function(serviceName) {
|
_startService: function(serviceName) {
|
||||||
this._hold.acquire();
|
this._hold.acquire();
|
||||||
if (this._userName) {
|
if (this._userName == "*guest") {
|
||||||
|
this._userVerifier.call_begin_verification_for_guest(this._cancellable,
|
||||||
|
Lang.bind(this, function(obj, result) {
|
||||||
|
try {
|
||||||
|
obj.call_begin_verification_for_guest_finish(result);
|
||||||
|
} catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) {
|
||||||
|
return;
|
||||||
|
} catch(e) {
|
||||||
|
this._reportInitError('Failed to start verification for guest', e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._hold.release();
|
||||||
|
}));
|
||||||
|
} else if (this._userName) {
|
||||||
this._userVerifier.call_begin_verification_for_user(serviceName,
|
this._userVerifier.call_begin_verification_for_user(serviceName,
|
||||||
this._userName,
|
this._userName,
|
||||||
this._cancellable,
|
this._cancellable,
|
||||||
|
Loading…
Reference in New Issue
Block a user