[node-patches] Change in ovirt-node[master]: Add password_check to password fields

hadong0720 at gmail.com hadong0720 at gmail.com
Fri Jul 12 12:44:09 UTC 2013


hadong has uploaded a new change for review.

Change subject: Add password_check to password fields
......................................................................

Add password_check to password fields

Previously no “weak password" indication when set a weak password
in password_page.
Now the migrated password_check function was used in the pasword
wigets to return informative messages to the user.

Change-Id: Iff668859b72176c64b4bbc2a08ac6419d021271b
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=983449
Signed-off-by: hadong <hadong0720 at gmail.com>
---
M src/ovirt/node/installer/core/password_page.py
1 file changed, 13 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/67/16767/1

diff --git a/src/ovirt/node/installer/core/password_page.py b/src/ovirt/node/installer/core/password_page.py
index 1877a11..a4b1218 100644
--- a/src/ovirt/node/installer/core/password_page.py
+++ b/src/ovirt/node/installer/core/password_page.py
@@ -19,6 +19,7 @@
 # MA  02110-1301, USA.  A copy of the GNU General Public License is
 # also available at http://www.gnu.org/copyleft/gpl.html.
 from ovirt.node import plugins, ui, exceptions
+from ovirt.node.utils.security import password_check
 
 """
 Password page of the installer
@@ -47,6 +48,8 @@
               ui.PasswordEntry("admin.password", "Password:"),
               ui.PasswordEntry("admin.password_confirmation",
                                "Confirm Password:"),
+              ui.Divider("divider[1]"),
+              ui.Label("password.info", "")
               ]
         self.widgets.add(ws)
         page = ui.Page("password", ws)
@@ -62,11 +65,18 @@
             admin_pw, admin_pw_conf = self._model.get("admin.password", ""), \
                 self._model.get("admin.password_confirmation", "")
 
-            if admin_pw != admin_pw_conf:
-                raise exceptions.InvalidData("Passwords must be the same.")
-            else:
+            try:
+                min_pw_length = 1
+                msg = password_check(admin_pw, admin_pw_conf, min_pw_length)
                 self.widgets["admin.password"].valid(True)
                 self.widgets["admin.password_confirmation"].valid(True)
+                if msg:
+                    self.widgets["password.info"].text(msg)
+                else:
+                    self.widgets["password.info"].text("")
+            except ValueError as e:
+                self.widgets["password.info"].text("")
+                raise exceptions.InvalidData(e.message)
 
     def on_merge(self, effective_changes):
         changes = self.pending_changes(False)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iff668859b72176c64b4bbc2a08ac6419d021271b
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: hadong <hadong0720 at gmail.com>



More information about the node-patches mailing list