Exemplo n.º 1
0
    def on_change(self, changes):
        if changes.contains_any(["upgrade.password",
                                 "upgrade.password_confirmation"]):
            self._model.update(changes)
            up_pw, up_pw_conf = self._model.get("upgrade.password", ""), \
                self._model.get("upgrade.password_confirmation", "")

            try:
                min_pw_length = 1
                msg = password_check(up_pw, up_pw_conf, min_pw_length)
                self.widgets["upgrade.password"].valid(True)
                self.widgets["upgrade.password_confirmation"].valid(True)
                if msg:
                    self.widgets["password.info"].text(msg)
                else:
                    self.widgets["password.info"].text("")
                    if not up_pw and not up_pw_conf:
                        msg = self.__no_new_password_msg
                        self.widgets["password.info"].text(msg)
            except ValueError as e:
                self.widgets["password.info"].text("")
                raise exceptions.InvalidData(e.message)

        if changes.contains_any(["upgrade.current_password"]):
            # Hide any message which was shown
            self.widgets["current_password.info"].text("")
Exemplo n.º 2
0
 def _validates(self):
     if self.is_password:
         self.logger.debug("Doing security check")
         msg = ""
         pw, pwc = self._values()
         try:
             msg = security.password_check(pw, pwc, min_length=self.min_length)
         except ValueError as e:
             msg = e.message
             if msg:
                 raise InvalidData(msg)
         self._additional_notice = msg
Exemplo n.º 3
0
 def _validates(self):
     if self.is_password:
         self.logger.debug("Doing security check")
         msg = ""
         pw, pwc = self._values()
         try:
             msg = security.password_check(pw, pwc,
                                           min_length=self.min_length)
         except ValueError as e:
             msg = e.message
             if msg:
                 raise InvalidData(msg)
         self._additional_notice = msg
Exemplo n.º 4
0
    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)
Exemplo n.º 5
0
    def __ask_and_set_user_pasword(self, username):
        min_pw_length = 1

        print("\n Password Configuration\n")
        print("System Administrator (%s):\n" % username)
        print("Changing password for user '%s'." % username)
        pw = getpass.getpass("New password: "******"Reytpe new Password: "******"Running password check")
            msg = password_check(pw, pwc, min_pw_length)
            if msg:
                self.logger.warn(msg)
            self.logger.debug("Setting password: %s" % str(all_args))
            security.Passwd().set_password(username, pw)
            self.logger.info("Password updated successfully.")
        except ValueError as e:
            self.logger.exception("Exception:")
            self.logger.error("Password update failed: %s" % e.message)
Exemplo n.º 6
0
    def __ask_and_set_user_pasword(self, username):
        min_pw_length = 1

        print("\n Password Configuration\n")
        print("System Administrator (%s):\n" % username)
        print("Changing password for user '%s'." % username)
        pw = getpass.getpass("New password: "******"Reytpe new Password: "******"Running password check")
            msg = password_check(pw, pwc, min_pw_length)
            if msg:
                self.logger.warn(msg)
            self.logger.debug("Setting password: %s" % str(all_args))
            security.Passwd().set_password(username, pw)
            self.logger.info("Password updated successfully.")
        except ValueError as e:
            self.logger.exception("Exception:")
            self.logger.error("Password update failed: %s" % e.message)