[PATCH] Add a gui password spoke
Chris Lumens
clumens at redhat.com
Thu Aug 23 18:54:09 UTC 2012
> This spoke sets the root password, or if left blank disables the root
> login. Some level of validation is done, however the validation happens
> at the apply() stage. This sets the spoke to not complete if there is
> some error in validation. Next time the user clicks the spoke they'll
> see what kind of validate error they got. I couldn't figure out a way
> to prevent leaving the spoke if the password didn't validate while using
> the update_info() function.
Applying the following patch after your patch enables checking when the
back button is clicked, and not letting you leave if it's a weak
password:
diff --git a/pyanaconda/ui/gui/spokes/password.py b/pyanaconda/ui/gui/spokes/password.py
index 5f61ec1..1c96c1f 100644
--- a/pyanaconda/ui/gui/spokes/password.py
+++ b/pyanaconda/ui/gui/spokes/password.py
@@ -83,19 +83,15 @@ class PasswordSpoke(NormalSpoke):
return _("Root password is set")
def apply(self):
- if self._validatePassword():
- 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
+ if self._password:
+ self.data.rootpw.password = cryptPassword(self._password)
+ self.data.rootpw.isCrypted = True
+ self.data.rootpw.lock = False
else:
- self.window.clear_info()
- self.window.set_info(Gtk.MessageType.WARNING, self._error)
+ # Blank password case, disable the account
+ self.data.rootpw.lock = True
+ self.data.rootpw.password = ''
+ self.data.rootpw.isCrypted = False
@property
def completed(self):
@@ -153,3 +149,12 @@ class PasswordSpoke(NormalSpoke):
self.window.clear_info()
self._error = False
return True
+
+ def on_back_clicked(self, button):
+ if self._validatePassword():
+ self.window.clear_info()
+ NormalSpoke.on_back_clicked(self, button)
+ else:
+ self.window.clear_info()
+ self.window.set_info(Gtk.MessageType.WARNING, self._error)
+ self.window.show_all()
However, enforcing the checks makes this a pretty annoying screen. We
might want some way of allowing you to bypass it anyway.
I wouldn't worry about the category for now. You put it right where I
would.
Also, has mizmo taken a look and suggested anything as far as design
goes? I know we're just whipping this up as a stop-gap, but she might
still have an idea or two to make it look as nice as it can given our
time constraints.
- Chris
More information about the anaconda-patches
mailing list