[PATCH] Clear the kickstart password if cleared by the user (#1133185)

David Shea dshea at redhat.com
Fri Sep 5 20:28:10 UTC 2014


If the user re-enters the password spoke and clears the password,
for-real clear the password instead of leaving it blank in the UI and
set in ksdata. Treat empty passwords in the TUI as unset passwords.
---
 pyanaconda/ui/gui/spokes/password.py | 14 +++++++++-----
 pyanaconda/ui/tui/spokes/__init__.py |  5 +++++
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/password.py b/pyanaconda/ui/gui/spokes/password.py
index ee2da7d..77fd2b1 100644
--- a/pyanaconda/ui/gui/spokes/password.py
+++ b/pyanaconda/ui/gui/spokes/password.py
@@ -130,16 +130,20 @@ class PasswordSpoke(FirstbootSpokeMixIn, NormalSpoke, GUISpokeInputCheckHandler)
 
     def apply(self):
         pw = self.pw.get_text()
+
+        # value from the kickstart changed
+        self.data.rootpw.seen = False
+        self._kickstarted = False
+
+        self.data.rootpw.lock = False
+
         if not pw:
+            self.data.rootpw.password = None
+            self.data.rootpw.isCrypted = False
             return
 
         self.data.rootpw.password = cryptPassword(pw)
         self.data.rootpw.isCrypted = True
-        self.data.rootpw.lock = False
-
-        # value from the kickstart changed
-        self.data.rootpw.seen = False
-        self._kickstarted = False
 
         self.pw.set_placeholder_text("")
         self.confirm.set_placeholder_text("")
diff --git a/pyanaconda/ui/tui/spokes/__init__.py b/pyanaconda/ui/tui/spokes/__init__.py
index dd27350..4f72600 100644
--- a/pyanaconda/ui/tui/spokes/__init__.py
+++ b/pyanaconda/ui/tui/spokes/__init__.py
@@ -130,6 +130,11 @@ class EditTUIDialog(NormalTUISpoke):
                 print(_(PASSWORD_CONFIRM_ERROR_TUI))
                 return None
 
+            # If an empty password was provided, unset the value
+            if not pw:
+                self.value = ""
+                return None
+
             valid, strength, message = validatePassword(pw, user=None)
 
             if not valid:
-- 
2.0.0



More information about the anaconda-patches mailing list