[gnome-boxes/check-whether-express-install-needs-password] unattended-installer/setup-box: Check libosinfo for optional passwords
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/check-whether-express-install-needs-password] unattended-installer/setup-box: Check libosinfo for optional passwords
- Date: Wed, 20 Feb 2019 16:28:03 +0000 (UTC)
commit 88f40dada74d186b6796d9027c4582499a88a87d
Author: Felipe Borges <felipeborges gnome org>
Date: Wed Feb 20 17:20:02 2019 +0100
unattended-installer/setup-box: Check libosinfo for optional passwords
libosinfo is able to tell us whether a given OS needs a password
for its install scripts. This way we can guarantee that users won't
perform Express Installations in which they will be locked out of
their session for not knowing the password created at installation.
Fixes #99
data/ui/unattended-setup-box.ui | 1 +
src/unattended-installer.vala | 14 ++++++++++++++
src/unattended-setup-box.vala | 21 +++++++++++++++++++++
3 files changed, 36 insertions(+)
---
diff --git a/data/ui/unattended-setup-box.ui b/data/ui/unattended-setup-box.ui
index 3d11722f..fab22ebf 100644
--- a/data/ui/unattended-setup-box.ui
+++ b/data/ui/unattended-setup-box.ui
@@ -192,6 +192,7 @@
<signal name="changed" handler="on_password_entry_changed"/>
<signal name="focus-out-event" handler="on_password_entry_focus_out"/>
<signal name="activate" handler="on_password_entry_activated"/>
+ <signal name="notify::text" handler="on_mandatory_input_changed"/>
</object>
</child>
</object>
diff --git a/src/unattended-installer.vala b/src/unattended-installer.vala
index 7de5c622..62f8c690 100644
--- a/src/unattended-installer.vala
+++ b/src/unattended-installer.vala
@@ -27,6 +27,20 @@
}
}
+ public bool needs_password {
+ get {
+ foreach (var s in scripts.get_elements ()) {
+ var script = s as InstallScript;
+
+ var param = script.get_config_param (INSTALL_CONFIG_PROP_USER_PASSWORD);
+ if (param == null || param.is_optional ())
+ return false;
+ }
+
+ return true;
+ }
+ }
+
public UnattendedSetupBox setup_box;
public File? disk_file; // Used for installer scripts, user avatar and pre-installation drivers
diff --git a/src/unattended-setup-box.vala b/src/unattended-setup-box.vala
index 1ecfc086..a6cf96b5 100644
--- a/src/unattended-setup-box.vala
+++ b/src/unattended-setup-box.vala
@@ -11,6 +11,7 @@
public bool ready_for_express {
get {
return username != "" &&
+ !needs_password &&
(product_key_format == null ||
product_key_entry.text_length == product_key_format.length);
}
@@ -72,6 +73,25 @@
public signal void user_wants_to_create (); // User wants to already create the VM
+ private bool _needs_password;
+ private bool needs_password {
+ get {
+ if (password != "")
+ return false;
+
+ if (_needs_password) {
+ password_notebook.next_page ();
+ password_entry.grab_focus ();
+ }
+
+ return _needs_password;
+ }
+
+ set {
+ _needs_password = value;
+ }
+ }
+
[GtkChild]
private Gtk.InfoBar needs_internet_bar;
[GtkChild]
@@ -110,6 +130,7 @@ public UnattendedSetupBox (InstallerMedia media, string? product_key_format, boo
var msg = _("Express installation of %s requires an internet connection.").printf (media.label);
needs_internet_label.label = msg;
needs_internet_bar.visible = needs_internet;
+ needs_password = (media as UnattendedInstaller).needs_password;
media_path = media.device_file;
keyfile = new GLib.KeyFile ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]