summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbfox <bfox>2001-07-11 22:19:48 +0000
committerbfox <bfox>2001-07-11 22:19:48 +0000
commitdc97c5561bf24a9eb2bf7083771ace6146e799a0 (patch)
tree0c56cf7e42f7c08092e821258946139ca45dc643
parent76b38094a6523e79e33cfc21ac8c35ed3998076a (diff)
downloadanaconda-dc97c5561bf24a9eb2bf7083771ace6146e799a0.tar.gz
anaconda-dc97c5561bf24a9eb2bf7083771ace6146e799a0.tar.xz
anaconda-dc97c5561bf24a9eb2bf7083771ace6146e799a0.zip
grub password screen
-rw-r--r--iw/bootloader_gui.py96
-rw-r--r--iw/bootloaderpassword_gui.py86
2 files changed, 93 insertions, 89 deletions
diff --git a/iw/bootloader_gui.py b/iw/bootloader_gui.py
index 5a1f3fc0f..d6e25d015 100644
--- a/iw/bootloader_gui.py
+++ b/iw/bootloader_gui.py
@@ -52,6 +52,11 @@ class BootloaderWindow (InstallWindow):
def getNext (self):
if self.none_radio.get_active ():
self.dispatch.skipStep("instbootloader")
+ self.dispatch.skipStep("bootloaderpassword")
+ elif self.lilo_radio.get_active ():
+ self.dispatch.skipStep("bootloaderpassword")
+ elif self.grub_radio.get_active ():
+ self.dispatch.skipStep("bootloaderpassword", skip = 0)
elif len(self.bootDevice.keys()) > 0:
self.dispatch.skipStep("instbootloader", skip = 0)
@@ -61,7 +66,7 @@ class BootloaderWindow (InstallWindow):
self.bl.setUseGrub(self.grub_radio.get_active())
self.bl.args.set(self.appendEntry.get_text())
-
+
default = None
linuxDevice = None
for index in range(self.numImages):
@@ -79,11 +84,6 @@ class BootloaderWindow (InstallWindow):
if not default:
default = linuxDevice
- if self.usegrubpasscb.get_active():
- self.bl.setPassword(self.password, isCrypted = 0)
- else:
- self.bl.setPassword(None)
-
self.bl.images.setDefault(default)
@@ -142,8 +142,7 @@ class BootloaderWindow (InstallWindow):
list = self.bootDevice.keys()
list.extend ([self.appendEntry, self.editBox, self.imageList,
- self.liloLocationBox, self.radioBox, self.sw,
- self.passtable])
+ self.liloLocationBox, self.radioBox, self.sw])
for n in list:
n.set_sensitive (state)
@@ -243,10 +242,8 @@ class BootloaderWindow (InstallWindow):
def bootloaderchange(self, widget):
if self.lilo_radio.get_active():
selected = "lilo"
- self.passtable.set_sensitive(FALSE)
elif self.grub_radio.get_active():
selected = "grub"
- self.passtable.set_sensitive(TRUE)
elif self.none_radio.get_active():
return
@@ -276,56 +273,6 @@ class BootloaderWindow (InstallWindow):
except:
pass
- def passwordDialog(self, *args):
- dialog = GnomeDialog(_("GRUB Password"))
- dialog.append_button (_("OK"))
- dialog.append_button (_("Cancel"))
- dialog.set_position(WIN_POS_CENTER)
- dialog.close_hides(TRUE)
-
- maintable = GtkTable()
- maintable.set_row_spacings (5)
- maintable.set_col_spacings (5)
- pass1 = GtkLabel (_("Bootloader Password: "))
- pass1.set_alignment (0.0, 0.5)
- maintable.attach (pass1, 0, 1, 1, 2, FILL, 0, 10)
- pass2 = GtkLabel (_("Confirm: "))
- pass2.set_alignment (0.0, 0.5)
- maintable.attach (pass2, 0, 1, 2, 3, FILL, 0, 10)
- self.pw = GtkEntry (16)
- self.pw.set_visibility (FALSE)
- self.confirm = GtkEntry (16)
- self.confirm.set_visibility (FALSE)
- if self.password:
- self.pw.set_text(self.password)
- self.confirm.set_text(self.password)
- maintable.attach (self.pw, 1, 2, 1, 2, 0, 5)
- maintable.attach (self.confirm, 1, 2, 2, 3, 0, 5)
- dialog.vbox.pack_start(maintable)
- dialog.show_all()
-
- while 1:
- rc = dialog.run()
-
- # user hit cancel, do nothing
- if rc == 1:
- dialog.close()
- return
-
- pw = self.pw.get_text()
- confirm = self.confirm.get_text()
-
- if pw != confirm:
- self.intf.messageWindow(_("Passwords Do Not Match"),
- _("Passwords do not match"))
- continue
-
- self.password = pw
- if self.checkLiloReqs():
- self.ics.setNextEnabled(1)
- dialog.close()
- break
-
# LiloWindow tag="lilo"
def getScreen(self, dispatch, bl, fsset, diskSet):
self.dispatch = dispatch
@@ -426,35 +373,6 @@ class BootloaderWindow (InstallWindow):
box.pack_start(self.radio_vbox, FALSE)
- self.passtable = GtkTable (3, 3)
- self.passtable.set_row_spacings (5)
- self.passtable.set_col_spacings (5)
- grubpassinfo = GtkLabel(_("A GRUB password prevents users from passing arbitrary options to the kernel. For highest security, we recommend setting a password, but this is not necessary for more casual users."))
- self.password = None
- grubpassinfo.set_line_wrap(TRUE)
- grubpassinfo.set_usize(400, -1)
- grubpassinfo.set_alignment(0.0,0.0)
- self.passtable.attach(grubpassinfo, 0, 3, 0, 1, FILL|EXPAND, 0, 10)
-
- self.usegrubpasscb = GtkCheckButton(_("Use a GRUB Password?"))
- self.passtable.attach(self.usegrubpasscb, 0, 1, 1, 2, FILL, 0, 10)
- self.passbutton = GtkButton(_("Set Password"))
- self.passtable.attach(self.passbutton, 1, 2, 1, 2, 0, 0, 10)
-
- self.usegrubpasscb.connect("toggled", self.usePasswordToggle)
- self.passbutton.connect("clicked", self.passwordDialog)
- if self.bl.password:
- self.usegrubpasscb.set_active(1)
- if self.bl.pure:
- self.password = self.bl.pure
- self.usePasswordToggle()
-
- bogus = GtkLabel("")
- self.passtable.attach(bogus, 2, 3, 1, 2, FILL|EXPAND, 0, 10)
-
- box.pack_start (GtkHSeparator (), FALSE)
- box.pack_start(self.passtable, FALSE)
-
box.pack_start (GtkHSeparator (), FALSE)
box.pack_start (self.radioBox, FALSE)
diff --git a/iw/bootloaderpassword_gui.py b/iw/bootloaderpassword_gui.py
new file mode 100644
index 000000000..0cf274987
--- /dev/null
+++ b/iw/bootloaderpassword_gui.py
@@ -0,0 +1,86 @@
+from iw_gui import *
+
+from gtk import *
+from gnome.ui import *
+from translate import _, N_
+import GdkImlib
+import gui
+
+class BootloaderPasswordWindow (InstallWindow):
+
+ def getNext (self):
+ if self.usegrubpasscb.get_active():
+ self.bl.setPassword(self.pw.get_text(), isCrypted = 0)
+ else:
+ self.bl.setPassword(None)
+
+ def toggle (self, *args):
+ self.passtable.set_sensitive(self.usegrubpasscb.get_active())
+ self.ics.setNextEnabled(not self.usegrubpasscb.get_active())
+
+ def rootPasswordsMatch (self, *args):
+ pw = self.pw.get_text ()
+ confirm = self.confirm.get_text ()
+
+ if pw == confirm and len (pw) >= 6:
+ self.ics.setNextEnabled (TRUE)
+ self.rootStatus.set_text (_("Password accepted."))
+ else:
+ if not pw and not confirm:
+ self.rootStatus.set_text ("")
+ elif len (pw) < 6:
+ self.rootStatus.set_text (_("Password is too short."))
+ else:
+ self.rootStatus.set_text (_("Passwords do not match."))
+
+ self.ics.setNextEnabled (FALSE)
+
+ def getScreen(self, bl):
+ self.bl = bl
+
+ box = GtkVBox(FALSE, 5)
+ box.set_border_width (5)
+
+ self.forward = lambda widget, box=box: box.focus (DIR_TAB_FORWARD)
+
+ self.passtable = GtkTable (3, 3)
+ self.passtable.set_row_spacings (5)
+ self.passtable.set_col_spacings (5)
+ grubpassinfo = GtkLabel(_("A GRUB password prevents users from passing arbitrary options to the kernel. For highest security, we recommend setting a password, but this is not necessary for more casual users."))
+ self.password = None
+ grubpassinfo.set_line_wrap(TRUE)
+ grubpassinfo.set_usize(400, -1)
+ grubpassinfo.set_alignment(0.0,0.0)
+ box.pack_start(grubpassinfo, FALSE)
+
+ self.usegrubpasscb = GtkCheckButton(_("Use a GRUB Password?"))
+ box.pack_start(self.usegrubpasscb, FALSE)
+
+ self.passtable.attach(GtkLabel(_("Password:")), 0, 1, 2, 3, FILL, 0, 10)
+ self.pw = GtkEntry (16)
+ self.pw.set_visibility (FALSE)
+ self.passtable.attach(self.pw, 1, 2, 2, 3, FILL, 0, 10)
+ self.passtable.attach(GtkLabel(_("Confirm:")), 0, 1, 3, 4, FILL, 0, 10)
+ self.confirm = GtkEntry (16)
+ self.confirm.set_visibility (FALSE)
+ self.passtable.attach(self.confirm, 1, 2, 3, 4, FILL, 0, 10)
+
+ if self.bl.getPassword():
+ passwd = self.bl.getPassword()
+ self.pw.set_text(passwd)
+ self.confirm.set_text(passwd)
+ self.usegrubpasscb.set_active(TRUE)
+
+ self.pw.connect ("changed", self.rootPasswordsMatch)
+ self.pw.connect ("activate", self.forward)
+ self.confirm.connect ("changed", self.rootPasswordsMatch)
+ self.confirm.connect ("activate", self.forward)
+ self.passtable.set_sensitive(self.usegrubpasscb.get_active())
+ self.usegrubpasscb.connect("toggled", self.toggle)
+
+ self.rootStatus = GtkLabel(_("Please enter password"))
+ self.passtable.attach(self.rootStatus, 1, 2, 4, 5, FILL, 0, 10)
+ box.pack_start(self.passtable, FALSE)
+
+ return box
+