[PATCH (nice to have)] Force a root password to be set (#869675)

Jesse Keating jkeating at redhat.com
Mon Oct 29 23:27:47 UTC 2012


---
 pyanaconda/ui/gui/spokes/password.glade |  2 +-
 pyanaconda/ui/gui/spokes/password.py    | 16 +++++++---------
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/password.glade b/pyanaconda/ui/gui/spokes/password.glade
index 23b0c73..363ed36 100644
--- a/pyanaconda/ui/gui/spokes/password.glade
+++ b/pyanaconda/ui/gui/spokes/password.glade
@@ -116,7 +116,7 @@
                       <object class="GtkLabel" id="details">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">The root account is used for administering the system.  Enter a password for the root user.  Leave blank to disable (lock) the account.</property>
+                        <property name="label" translatable="yes">The root account is used for administering the system.  Enter a password for the root user.</property>
                         <property name="wrap">True</property>
                       </object>
                       <packing>
diff --git a/pyanaconda/ui/gui/spokes/password.py b/pyanaconda/ui/gui/spokes/password.py
index c67afb6..6ffb2f6 100644
--- a/pyanaconda/ui/gui/spokes/password.py
+++ b/pyanaconda/ui/gui/spokes/password.py
@@ -83,15 +83,9 @@ class PasswordSpoke(NormalSpoke):
             return _("Root password is not set")
 
     def apply(self):
-        if self._password:
-            self.data.rootpw.password = cryptPassword(self._password)
-            self.data.rootpw.isCrypted = True
-            self.data.rootpw.lock = False
-        else:
-            # Blank password case, disable the account
-            self.data.rootpw.lock = True
-            self.data.rootpw.password = ''
-            self.data.rootpw.isCrypted = False
+        self.data.rootpw.password = cryptPassword(self._password)
+        self.data.rootpw.isCrypted = True
+        self.data.rootpw.lock = False
 
     @property
     def completed(self):
@@ -105,6 +99,10 @@ class PasswordSpoke(NormalSpoke):
         pw = self.pw.get_text()
         confirm = self.confirm.get_text()
 
+        if not pw and not confirm:
+            self._error = _("You must provide and confirm a password.")
+            return False
+
         try:
             self._error = validatePassword(pw, confirm)
         except PWQError as (e, msg):
-- 
1.7.11.4



More information about the anaconda-patches mailing list