[node-patches] Change in ovirt-node[master]: installer: Fix password page

fabiand at fedoraproject.org fabiand at fedoraproject.org
Tue Aug 13 14:23:34 UTC 2013


Fabian Deutsch has uploaded a new change for review.

Change subject: installer: Fix password page
......................................................................

installer: Fix password page

Previously the installer accepted an empty password but failed to
complete the installation. This happened due to an incorrect password
check.
Now the password is checked correctly and the user get's feedback about
the different problems.
Additionally the installer only allows the user to carry on when a valid
password is given.

Change-Id: I2daeebd9ae5079d39af1b4f1b7be6eed9a9ce790
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=985275
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M src/ovirt/node/installer/core/password_page.py
1 file changed, 17 insertions(+), 28 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/29/18029/1

diff --git a/src/ovirt/node/installer/core/password_page.py b/src/ovirt/node/installer/core/password_page.py
index 60ea3f8..33d23fb 100644
--- a/src/ovirt/node/installer/core/password_page.py
+++ b/src/ovirt/node/installer/core/password_page.py
@@ -18,8 +18,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 # 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
+from ovirt.node import plugins, ui
 
 """
 Password page of the installer
@@ -45,43 +44,33 @@
         ws = [ui.Header("header[0]",
                         "Require a password for the admin user?"),
               ui.Divider("divider[0]"),
-              ui.PasswordEntry("admin.password", "Password:"),
-              ui.PasswordEntry("admin.password_confirmation",
-                               "Confirm Password:"),
-              ui.Divider("divider[1]"),
-              ui.Label("password.info", "")
+              ui.ConfirmedEntry("admin.password", "Password:",
+                                is_password=True, min_length=3)
               ]
-        self.widgets.add(ws)
+
         page = ui.Page("password", ws)
         page.buttons = [ui.QuitButton("button.quit", "Quit"),
                         ui.Button("button.back", "Back"),
-                        ui.SaveButton("button.next", "Install")]
+                        ui.SaveButton("button.next", "Install", enabled=False)]
+
+        self.widgets.add(page)
+
+        # We want the plugin/page to be invalid, when the password is not
+        # secure, this prevents the user from saving/going to the next page
+        set_plugin_validity = lambda target, is_secure: \
+            self.on_valid(True if is_secure else False)
+        self.widgets["admin.password"].on_password_security_change\
+            .connect(set_plugin_validity)
+
         return page
 
     def on_change(self, changes):
-        if changes.contains_any(["admin.password",
-                                 "admin.password_confirmation"]):
-            self._model.update(changes)
-            admin_pw, admin_pw_conf = self._model.get("admin.password", ""), \
-                self._model.get("admin.password_confirmation", "")
-
-            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)
+        pass
 
     def on_merge(self, effective_changes):
         changes = self.pending_changes(False)
         if changes.contains_any(["button.back"]):
             self.application.ui.navigate.to_previous_plugin()
-        elif changes.contains_any(["admin.password_confirmation",
+        elif changes.contains_any(["admin.password",
                                    "button.next"]):
             self.application.ui.navigate.to_next_plugin()


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2daeebd9ae5079d39af1b4f1b7be6eed9a9ce790
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