[node-patches] Change in ovirt-node[master]: security: Fix password checks

fabiand at fedoraproject.org fabiand at fedoraproject.org
Mon Mar 4 08:57:26 UTC 2013


Fabian Deutsch has uploaded a new change for review.

Change subject: security: Fix password checks
......................................................................

security: Fix password checks

Change-Id: Ic21530a92d40a7357ad3b2ec7387f55fbfe3ddee
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M scripts/tui/src/ovirt/node/setup/security_page.py
1 file changed, 11 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/17/12617/1

diff --git a/scripts/tui/src/ovirt/node/setup/security_page.py b/scripts/tui/src/ovirt/node/setup/security_page.py
index 39acaf3..ba5356b 100644
--- a/scripts/tui/src/ovirt/node/setup/security_page.py
+++ b/scripts/tui/src/ovirt/node/setup/security_page.py
@@ -28,7 +28,7 @@
 
 
 class Plugin(plugins.NodePlugin):
-    _model = None
+    _model = {}
 
     def name(self):
         return "Security"
@@ -49,15 +49,9 @@
         return model
 
     def validators(self):
-        same_as_password = plugins.Validator.SameAsIn(self,
-                                                      "passwd.admin.password",
-                                                      "Password")
         number_or_empty = valid.Number(bounds=[0, None]) | \
             valid.Empty()
-
-        return {"strongrng.num_bytes": number_or_empty,
-                "passwd.admin.password": valid.Text(),
-                "passwd.admin.password_confirmation": same_as_password,
+        return {"strongrng.num_bytes": number_or_empty
                 }
 
     def ui_content(self):
@@ -77,7 +71,15 @@
         return page
 
     def on_change(self, changes):
-        pass
+        if changes.contains_any(["passwd.admin.password",
+                                 "passwd.admin.password_confirmation"]):
+            self._model.update(changes)
+            if self._model.get("passwd.admin.password", "") != \
+                self._model.get("passwd.admin.password_confirmation", ""):
+                raise exceptions.InvalidData("Passwords must be the same.")
+            else:
+                self.widgets["passwd.admin.password"].valid(True)
+                self.widgets["passwd.admin.password_confirmation"].valid(True)
 
     def on_merge(self, effective_changes):
         self.logger.debug("Saving security page")


--
To view, visit http://gerrit.ovirt.org/12617
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic21530a92d40a7357ad3b2ec7387f55fbfe3ddee
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>



More information about the node-patches mailing list