ScreenShield: don't lock if the user has no password

If the user has no configured password (like the default user in
a live cd), the behavior should be as if the session was not locked
at all.

https://bugzilla.gnome.org/show_bug.cgi?id=701495
This commit is contained in:
Giovanni Campagna 2013-06-08 17:22:43 +02:00
parent 99af697cd7
commit aefdf15a45

View File

@ -1,5 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const AccountsService = imports.gi.AccountsService;
const Cairo = imports.cairo;
const Clutter = imports.gi.Clutter;
const Gio = imports.gi.Gio;
@ -1245,7 +1246,14 @@ const ScreenShield = new Lang.Class({
St.Clipboard.get_default().set_text(St.ClipboardType.CLIPBOARD, '');
St.Clipboard.get_default().set_text(St.ClipboardType.PRIMARY, '');
this._isLocked = true;
let userManager = AccountsService.UserManager.get_default();
let user = userManager.get_user(GLib.get_user_name());
if (this._isGreeter)
this._isLocked = true;
else
this._isLocked = user.password_mode != AccountsService.UserPasswordMode.NONE;
this.activate(animate);
this.emit('locked-changed');