[PATCH 2/4] Use the user data provided by kickstart

Brian C. Lane bcl at redhat.com
Thu Feb 28 18:18:01 UTC 2013


On Thu, Feb 28, 2013 at 11:09:40AM +0100, Martin Sivak wrote:
> ---
>  pyanaconda/ui/gui/spokes/user.py | 52 ++++++++++++++++++++++++++++++++++------
>  1 file changed, 45 insertions(+), 7 deletions(-)
> 
> diff --git a/pyanaconda/ui/gui/spokes/user.py b/pyanaconda/ui/gui/spokes/user.py
> index 927285c..36ab97f 100644
> --- a/pyanaconda/ui/gui/spokes/user.py
> +++ b/pyanaconda/ui/gui/spokes/user.py
> @@ -178,6 +178,18 @@ class UserSpoke(FirstbootSpokeMixIn, NormalSpoke):
>              self.username: True
>              }
>  
> +        # indicate when the password was set by kickstart
> +        self._user.password_kickstarted = self.data.user.seen
> +        if self._user.password_kickstarted:
> +            self.usepassword.set_active(self._user.password != "")
> +            if not self._user.isCrypted:
> +                self.pw.set_text(self._user.password)
> +                self.confirm.set_text(self._user.password)
> +            else:
> +                self.usepassword.set_active(True)
> +                self.pw.set_placeholder_text(_("The password was set by kickstart."))
> +                self.confirm.set_placeholder_text(_("The password was set by kickstart."))
> +        

^^^^^
KILL the spaces :)

>          # set up passphrase quality checker
>          self._pwq = pwquality.PWQSettings()
>          self._pwq.read_config()
> @@ -197,7 +209,7 @@ class UserSpoke(FirstbootSpokeMixIn, NormalSpoke):
>          if self.usepassword.get_active():
>              self._checkPassword()
>  
> -        if self.username.get_text() and self.usepassword.get_active():
> +        if self.username.get_text() and self.usepassword.get_active() and self._user.password == "":

line is getting a bit long

>              self.pw.grab_focus()
>          elif self.fullname.get_text():
>              self.username.grab_focus()
> @@ -221,12 +233,29 @@ class UserSpoke(FirstbootSpokeMixIn, NormalSpoke):
>          return (not self.data.rootpw.password) or self.data.rootpw.lock
>  
>      def apply(self):
> -        if self.username.get_text():
> -            self._user.name = self.username.get_text()
> -            self._user.gecos = self.fullname.get_text()
> -            self._user.password = cryptPassword(self.pw.get_text())
> -            self._user.isCrypted = True
> +        # set the password only if the user enters anything to the text entry
> +        # this should preserve the kickstart based password
> +        if self.usepassword.get_active():
> +            if self.pw.get_text():
> +                self._user.password_kickstarted = False
> +                self._user.password = cryptPassword(self.pw.get_text())
> +                self._user.isCrypted = True
> +                self.pw.set_placeholder_text("")
> +                self.confirm.set_placeholder_text("")
> +                

^^^^^
More spaces added

> +        # reset the password when the user unselects it
> +        else:
> +            self.pw.set_placeholder_text("")
> +            self.confirm.set_placeholder_text("")
> +            self._user.password = ""
> +            self._user.isCrypted = False
> +            self._user.password_kickstarted = False
> +            

Spaces.


-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 482 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/anaconda-patches/attachments/20130228/bb21579f/attachment.sig>


More information about the anaconda-patches mailing list