Example #1
0
 def save_password(self, account_name, password):
     if not kwalletbinding.kwallet_put('gajim', account_name, password):
         # stop using the KDE Wallet
         set_storage(SimplePasswordStorage())
         storage.save_password(account_name, password)
         return
     pwtoken = '<kwallet>'
     if not password:
         # no sense in looking up the empty string in the KWallet
         pwtoken = ''
     gajim.config.set_per('accounts', account_name, 'password', pwtoken)
     if account_name in gajim.connections:
         gajim.connections[account_name].password = password
Example #2
0
 def save_password(self, account_name, password):
     if not kwalletbinding.kwallet_put('gajim', account_name, password):
         # stop using the KDE Wallet
         set_storage(SimplePasswordStorage())
         storage.save_password(account_name, password)
         return
     pwtoken = '<kwallet>'
     if not password:
         # no sense in looking up the empty string in the KWallet
         pwtoken = ''
     gajim.config.set_per('accounts', account_name, 'password', pwtoken)
     if account_name in gajim.connections:
         gajim.connections[account_name].password = password
Example #3
0
 def get_password(self, account_name):
     pw = gajim.config.get_per("accounts", account_name, "password")
     if not pw or pw.startswith("gnomekeyring:"):
         # unset, empty or not ours
         return None
     if pw != "<kwallet>":
         # migrate the password
         if kwalletbinding.kwallet_put("gajim", account_name, pw):
             gajim.config.set_per("accounts", account_name, "password", "<kwallet>")
         else:
             # stop using the KDE Wallet
             set_storage(SimplePasswordStorage())
         return pw
     pw = kwalletbinding.kwallet_get("gajim", account_name)
     if pw is None:
         # stop using the KDE Wallet
         set_storage(SimplePasswordStorage())
     if not pw:
         # False, None, or the empty string
         return None
     return pw
Example #4
0
 def get_password(self, account_name):
     pw = gajim.config.get_per('accounts', account_name, 'password')
     if not pw or pw.startswith('gnomekeyring:'):
         # unset, empty or not ours
         return None
     if pw != '<kwallet>':
         # migrate the password
         if kwalletbinding.kwallet_put('gajim', account_name, pw):
             gajim.config.set_per('accounts', account_name, 'password',
              '<kwallet>')
         else:
             # stop using the KDE Wallet
             set_storage(SimplePasswordStorage())
         return pw
     pw = kwalletbinding.kwallet_get('gajim', account_name)
     if pw is None:
         # stop using the KDE Wallet
         set_storage(SimplePasswordStorage())
     if not pw:
         # False, None, or the empty string
         return None
     return pw
Example #5
0
 def get_password(self, account_name):
     pw = gajim.config.get_per('accounts', account_name, 'password')
     if not pw or pw.startswith('gnomekeyring:'):
         # unset, empty or not ours
         return None
     if pw != '<kwallet>':
         # migrate the password
         if kwalletbinding.kwallet_put('gajim', account_name, pw):
             gajim.config.set_per('accounts', account_name, 'password',
                                  '<kwallet>')
         else:
             # stop using the KDE Wallet
             set_storage(SimplePasswordStorage())
         return pw
     pw = kwalletbinding.kwallet_get('gajim', account_name)
     if pw is None:
         # stop using the KDE Wallet
         set_storage(SimplePasswordStorage())
     if not pw:
         # False, None, or the empty string
         return None
     return pw