示例#1
0
文件: user.py 项目: yugart/anaconda
    def apply(self):
        # set the password only if the user enters anything to the text entry
        # this should preserve the kickstart based password
        if self.password_required:
            if self.password:
                self.password_kickstarted = False
                self.user.password = crypt_password(self.password)
                self.user.is_crypted = True
                self.remove_placeholder_texts()

        # reset the password when the user unselects it
        else:
            self.remove_placeholder_texts()
            self.user.password = ""
            self.user.is_crypted = False
            self.password_kickstarted = False

        self.user.name = self.username
        self.user.gecos = self.fullname

        # We make it possible to clear users requested from kickstart (or DBus API)
        # during an interactive installation. This is done by setting their name
        # to "". Then during apply() we will check the user name and if it is
        # equal to "", we will remember that locally and not forward the user which
        # has been cleared to the DBus module, by using the remove_uset flag
        # for the set_user_list function.

        # record if the requested user has been explicitely unset
        self._requested_user_cleared = not self.user.name
        # clear the unset user (if any)
        set_user_list(self._users_module, self._user_list, remove_unset=True)
示例#2
0
    def apply(self):
        pw = self.password

        enabled = self.root_enabled
        self._users_module.SetRootAccountLocked(not enabled)

        if enabled:
            # the checkbox makes it possible to override the default Open SSH
            # policy of not allowing root to login with password
            ssh_login_override = self._root_password_ssh_login_override.get_active(
            )
            self._users_module.SetRootPasswordSSHLoginAllowed(
                ssh_login_override)

        if not pw:
            self._users_module.ClearRootPassword()
            return

        # we have a password - set it to kickstart data
        self._users_module.SetCryptedRootPassword(crypt_password(pw))

        # clear any placeholders
        self.remove_placeholder_texts()

        # Send ready signal to main event loop
        hubQ.send_ready(self.__class__.__name__)
示例#3
0
    def apply(self):
        if self.root_enabled and self.password:
            # Set the root password.
            self._users_module.SetCryptedRootPassword(
                crypt_password(self.password))

            # Unlock the root account.
            self._users_module.SetRootAccountLocked(False)

        else:
            # Reset the root password.
            self._users_module.ClearRootPassword()

            # Lock the root account.
            self._users_module.SetRootAccountLocked(True)

        if self.root_enabled:
            # the checkbox makes it possible to override the default Open SSH
            # policy of not allowing root to login with password
            ssh_login_override = self._root_password_ssh_login_override.get_active(
            )
            self._users_module.SetRootPasswordSSHLoginAllowed(
                ssh_login_override)

        # clear any placeholders
        self.remove_placeholder_texts()

        # Send ready signal to main event loop
        hubQ.send_ready(self.__class__.__name__)
示例#4
0
    def apply(self):
        pw = self.password

        self._users_module.SetRootAccountLocked(self._lock.get_active())

        if not pw:
            self._users_module.ClearRootPassword()
            return

        # we have a password - set it to kickstart data

        self._users_module.SetCryptedRootPassword(crypt_password(pw))

        # clear any placeholders
        self.remove_placeholder_texts()

        # Send ready signal to main event loop
        hubQ.send_ready(self.__class__.__name__, False)