コード例 #1
0
ファイル: jabbergui.py プロジェクト: AlexUlrich/digsby
            def success(st = None):
                print 'success!', st
                print 'setting password in', self.acct
                from common import profile
                self.acct.password = profile.crypt_pw(self.new1_password)

                for acct in profile.account_manager.accounts:
                    if acct.name == self.acct.username and acct.protocol == self.acct.protocol:
                        acct.update_info(password = profile.crypt_pw(self.new1_password))
                        break

                self.EndModal(wx.ID_OK)
コード例 #2
0
ファイル: smtp.py プロジェクト: Esteban-Rocha/digsby
    def _unglue_pw(cls, password):
        passwordstr = profile.plain_pw(password).encode("utf-8")
        if passwordstr:
            password, r = unpack_pstr(passwordstr)
            try:
                smtppassword, r = unpack_pstr(r)
            except Exception:
                smtppassword, r = "", ""
        else:
            raise ValueError("Can't decrypt %r", password)

        return profile.crypt_pw(password.decode("utf-8")), profile.crypt_pw(smtppassword.decode("utf-8"))
コード例 #3
0
ファイル: smtp.py プロジェクト: sgricci/digsby
    def _unglue_pw(cls, password):
        passwordstr = profile.plain_pw(password).encode('utf-8')
        if passwordstr:
            password, r = unpack_pstr(passwordstr)
            try:
                smtppassword, r = unpack_pstr(r)
            except Exception:
                smtppassword, r = '', ''
        else:
            raise ValueError("Can't decrypt %r", password)

        return profile.crypt_pw(password.decode('utf-8')), profile.crypt_pw(smtppassword.decode('utf-8'))
コード例 #4
0
ファイル: jabbergui.py プロジェクト: sgricci/digsby
            def success(st=None):
                print 'success!', st
                print 'setting password in', self.acct
                from common import profile
                self.acct.password = profile.crypt_pw(self.new1_password)

                for acct in profile.account_manager.accounts:
                    if acct.name == self.acct.username and acct.protocol == self.acct.protocol:
                        acct.update_info(
                            password=profile.crypt_pw(self.new1_password))
                        break

                self.EndModal(wx.ID_OK)
コード例 #5
0
ファイル: accountdialog.py プロジェクト: niterain/digsby
    def info(self):
        "Returns a Storage containing the attributes edited by this dialog."

        info = Storage(name=self.name.Value, protocol=self.protocol_name)

        info.protocol, info.name = strip_acct_id(info.protocol, info.name)

        if hasattr(self, "password"):
            info.password_len = len(self.password.Value)
            try:
                info.password = profile.crypt_pw(self.password.Value)
            except UnicodeEncodeError:
                # the database has corrupted the password.
                log.warning("corrupted password")
                info.password = ""
                self.password.Value = ""
                import hub

                hub.get_instance().on_error(
                    "This account's password has been corrupted somehow. Please report it immediately."
                )

        if hasattr(self, "host"):
            info.server = (self.host.Value, int(self.port.Value) if self.port.Value else "")

        if hasattr(self, "remote_alias"):
            info.remote_alias = self.remote_alias.Value

        if hasattr(self, "autologin"):
            info.autologin = bool(self.autologin.Value)

        if hasattr(self, "resource"):
            info.update(
                resource=self.resource.Value,
                priority=try_this(lambda: int(self.priority.Value), DEFAULT_JABBER_PRIORITY),
            )
        #                        ,
        #                        confserver = self.confserver.Value
        if hasattr(self, "dataproxy"):
            info.update(dataproxy=self.dataproxy.Value)

        for d in getattr(self.protocolinfo, "more_details", []):
            attr = d["store"]
            ctrl = getattr(self, attr)
            info[attr] = ctrl.Value

        getattr(self, "info_" + self.formtype, lambda *a: {})(info)

        for info_cb in self.info_callbacks:
            info_cb(info)

        defaults = self.protocolinfo.get("defaults", {})
        for k in defaults:
            if k not in info:
                info[k] = getattr(self.account, k, defaults.get(k))

        return info
コード例 #6
0
ファイル: smtp.py プロジェクト: Esteban-Rocha/digsby
 def __init__(self, **options):
     d = self.default
     self.smtp_server = options.get("smtp_server", d("smtp_server"))
     self.smtp_require_ssl = options.get("smtp_require_ssl", d("smtp_require_ssl"))
     self.smtp_port = options.get("smtp_port", d("smtp_port"))
     self.smtp_username = options.get("smtp_username", d("smtp_username"))
     self._email_address = options.get("email_address", d("email_address"))
     self._encrypted_smtppw = profile.crypt_pw(options.get("smtp_password", d("smtp_password")))
     self._encrypted_pw = options.pop("password")
     EmailAccount.__init__(self, password=self.password, **options)
コード例 #7
0
ファイル: smtp.py プロジェクト: sgricci/digsby
 def __init__(self, **options):
     d = self.default
     self.smtp_server       = options.get('smtp_server', d('smtp_server'))
     self.smtp_require_ssl  = options.get('smtp_require_ssl', d('smtp_require_ssl'))
     self.smtp_port         = options.get('smtp_port', d('smtp_port'))
     self.smtp_username     = options.get('smtp_username', d('smtp_username'))
     self._email_address    = options.get('email_address', d('email_address'))
     self._encrypted_smtppw = profile.crypt_pw(options.get('smtp_password', d('smtp_password')))
     self._encrypted_pw     = options.pop('password')
     EmailAccount.__init__(self, password=self.password, **options)
コード例 #8
0
ファイル: accountdialog.py プロジェクト: sgricci/digsby
    def info(self):
        'Returns a Storage containing the attributes edited by this dialog.'

        info = Storage(name = self.name.Value,
                       protocol = self.protocol_name)

        info.protocol, info.name = strip_acct_id(info.protocol, info.name)

        if hasattr(self, 'password'):
            info.password_len = len(self.password.Value)
            try:
                info.password = profile.crypt_pw(self.password.Value)
            except UnicodeEncodeError:
                # the database has corrupted the password.
                log.warning('corrupted password')
                info.password = ''
                self.password.Value = ''
                import hub
                hub.get_instance().on_error('This account\'s password has been corrupted somehow. Please report it immediately.')

        if hasattr(self, 'host'):
            info.server = (self.host.Value, int(self.port.Value) if self.port.Value else '')

        if hasattr(self, 'remote_alias'):
            info.remote_alias = self.remote_alias.Value

        if hasattr(self, 'autologin'):
            info.autologin = bool(self.autologin.Value)

        if hasattr(self, 'resource'):
            info.update(resource = self.resource.Value,
                        priority = try_this(lambda: int(self.priority.Value), DEFAULT_JABBER_PRIORITY))
#                        ,
#                        confserver = self.confserver.Value
        if hasattr(self, 'dataproxy'):
            info.update(dataproxy = self.dataproxy.Value)

        for d in getattr(self.protocolinfo, 'more_details', []):
            attr = d['store']
            ctrl = getattr(self, attr)
            info[attr] = ctrl.Value

        getattr(self, 'info_' + self.formtype, lambda *a: {})(info)

        for info_cb in self.info_callbacks:
            info_cb(info)

        defaults = self.protocolinfo.get('defaults', {})
        for k in defaults:
            if k not in info:
                info[k] = getattr(self.account, k, defaults.get(k))

        return info
コード例 #9
0
ファイル: jabbergui.py プロジェクト: AlexUlrich/digsby
 def yes_clicked(self, e):
     success = lambda: self.EndModal(wx.ID_YES)
     if self.delete:
         if self.acct.password != profile.crypt_pw(self.password):
             wx.MessageBox(_("Incorrect Password"), _("Incorrect Password"))
             return
         self.show_buttons(False)
         self.acct.delete_from_server(self.password,
                                       on_success=success,
                                       on_fail=lambda: (self.show_buttons(),
                                                       wx.MessageBox(message=_("Failed to delete account from the server."),
                                                                     caption=_("Delete Account - Failed"), style=wx.OK)))
     else:
         success()
コード例 #10
0
ファイル: smtp.py プロジェクト: Esteban-Rocha/digsby
    def update_info(self, **info):
        if not self.isflagged(NETWORK_FLAG):
            if "smtp_password" in info:
                self._encrypted_smtppw = profile.crypt_pw(info.pop("smtp_password"))

                if "password" in info:
                    self._encrypted_pw = info["password"]

            if "_encrypted_pw" in info and "_encrypted_smtppw" in info:
                self._encrypted_pw = info.pop("_encrypted_pw")
                self._encrypted_smtppw = info.pop("_encrypted_smtppw")

            info["password"] = self._glue_pw(self._encrypted_pw, self._encrypted_smtppw)
        else:
            self.password = info.pop("password")

        log.info("smtp update_info: %r", info)
        EmailAccount.update_info(self, **info)
コード例 #11
0
ファイル: jabbergui.py プロジェクト: sgricci/digsby
 def yes_clicked(self, e):
     success = lambda: self.EndModal(wx.ID_YES)
     if self.delete:
         if self.acct.password != profile.crypt_pw(self.password):
             wx.MessageBox(_("Incorrect Password"), _("Incorrect Password"))
             return
         self.show_buttons(False)
         self.acct.delete_from_server(
             self.password,
             on_success=success,
             on_fail=lambda:
             (self.show_buttons(),
              wx.MessageBox(message=_(
                  "Failed to delete account from the server."),
                            caption=_("Delete Account - Failed"),
                            style=wx.OK)))
     else:
         success()
コード例 #12
0
ファイル: smtp.py プロジェクト: sgricci/digsby
    def update_info(self, **info):
        if not self.isflagged(NETWORK_FLAG):
            if 'smtp_password' in info:
                self._encrypted_smtppw = profile.crypt_pw(info.pop('smtp_password'))

                if 'password' in info:
                    self._encrypted_pw = info['password']

            if '_encrypted_pw' in info and '_encrypted_smtppw' in info:
                self._encrypted_pw = info.pop('_encrypted_pw')
                self._encrypted_smtppw = info.pop('_encrypted_smtppw')

            info['password'] = self._glue_pw(self._encrypted_pw, self._encrypted_smtppw)
        else:
            self.password = info.pop('password')

        log.info("smtp update_info: %r", info)
        EmailAccount.update_info(self, **info)
コード例 #13
0
ファイル: accountbase.py プロジェクト: AlexUlrich/digsby
 def _crypt_set_pw(self, value):
     self.password = profile.crypt_pw(value)
コード例 #14
0
ファイル: smtp.py プロジェクト: Esteban-Rocha/digsby
 def _glue_pw(cls, encrypted_pw, encrypted_smtppw):
     password = pack_pstr(profile.plain_pw(encrypted_pw).encode("utf-8")).decode("utf-8")
     smtppw = pack_pstr(profile.plain_pw(encrypted_smtppw).encode("utf-8")).decode("utf-8")
     return profile.crypt_pw(password + smtppw)
コード例 #15
0
ファイル: smtp.py プロジェクト: sgricci/digsby
 def _glue_pw(cls, encrypted_pw, encrypted_smtppw):
     password = pack_pstr(profile.plain_pw(encrypted_pw).encode('utf-8')).decode('utf-8')
     smtppw = pack_pstr(profile.plain_pw(encrypted_smtppw).encode('utf-8')).decode('utf-8')
     return profile.crypt_pw(password + smtppw)
コード例 #16
0
ファイル: imaccount.py プロジェクト: sgricci/digsby
 def change_acct_password(self, password, callback=None):
     self.password = profile.crypt_pw(str(password))
     profile.update_account(self)
     callback.success()
コード例 #17
0
ファイル: accountbase.py プロジェクト: sgricci/digsby
 def _crypt_set_pw(self, value):
     self.password = profile.crypt_pw(value)