Beispiel #1
0
    def post_init(self):
        self.empty()
        self.append(self.ui.inflate('vh-mail:main'))

        self.binder = Binder(None, self)

        def post_mb_bind(object, collection, item, ui):
            ui.find('size').text = str_fsize(self.manager.get_usage(item))

        def post_mb_update(object, collection, item, ui):
            if ui.find('password').value:
                item.password = ui.find('password').value
                if item.password[:len("md5|")]!="md5|":       #If the password is not encrypted as md5, then encrypt it using userdbpw for consistency
                    udbpw = subprocess.Popen(
                        ['userdbpw', '-md5'],
                        stdout=subprocess.PIPE,
                        stdin=subprocess.PIPE
                    )
                    o, e = udbpw.communicate(
                        '%s\n%s\n' % (item.password, item.password)
                    )
                    item.password = "******"+o        #Prefix the hash with "md5|"

        self.find('mailboxes').post_item_bind = post_mb_bind
        self.find('mailboxes').post_item_update = post_mb_update
        self.find('mailboxes').filter = \
            lambda mb: self.context.session.identity in ['root', mb.owner]
        self.find('targets').new_item = lambda c: ForwardingTarget.create()

        self.binder.setup(self.manager.config)
Beispiel #2
0
    def post_init(self):
        self.empty()
        self.append(self.ui.inflate('vh-mail:main'))

        self.binder = Binder(None, self)

        def post_mb_bind(object, collection, item, ui):
            ui.find('size').text = str_fsize(self.manager.get_usage(item))

        def post_mb_update(object, collection, item, ui):
            if ui.find('password').value:
                item.password = ui.find('password').value
                if item.password[:len(
                        "md5|"
                )] != "md5|":  #If the password is not encrypted as md5, then encrypt it using userdbpw for consistency
                    udbpw = subprocess.Popen(['userdbpw', '-md5'],
                                             stdout=subprocess.PIPE,
                                             stdin=subprocess.PIPE)
                    o, e = udbpw.communicate('%s\n%s\n' %
                                             (item.password, item.password))
                    item.password = "******" + o  #Prefix the hash with "md5|"

        self.find('mailboxes').post_item_bind = post_mb_bind
        self.find('mailboxes').post_item_update = post_mb_update
        self.find('mailboxes').filter = \
            lambda mb: self.context.session.identity in ['root', mb.owner]
        self.find('targets').new_item = lambda c: ForwardingTarget.create()

        self.binder.setup(self.manager.config)
Beispiel #3
0
    def post_init(self):
        self.empty()
        self.append(self.ui.inflate("vh-mail:main"))

        self.binder = Binder(None, self)

        def post_mb_bind(object, collection, item, ui):
            ui.find("size").text = str_fsize(self.manager.get_usage(item))

        def post_mb_update(object, collection, item, ui):
            if ui.find("password").value:
                item.password = ui.find("password").value

        self.find("mailboxes").post_item_bind = post_mb_bind
        self.find("mailboxes").post_item_update = post_mb_update
        self.find("mailboxes").filter = lambda mb: self.context.session.identity in ["root", mb.owner]
        self.find("targets").new_item = lambda c: ForwardingTarget.create()

        self.binder.setup(self.manager.config)
Beispiel #4
0
    def post_init(self):
        self.empty()
        self.append(self.ui.inflate('vh-mail:main'))

        self.binder = Binder(None, self)

        def post_mb_bind(object, collection, item, ui):
            ui.find('size').text = str_fsize(self.manager.get_usage(item))

        def post_mb_update(object, collection, item, ui):
            if ui.find('password').value:
                item.password = ui.find('password').value

        self.find('mailboxes').post_item_bind = post_mb_bind
        self.find('mailboxes').post_item_update = post_mb_update
        self.find('mailboxes').filter = \
            lambda mb: self.context.session.identity in ['root', mb.owner]
        self.find('targets').new_item = lambda c: ForwardingTarget.create()

        self.binder.setup(self.manager.config)