def save_account(self, acc): acc.error_notified = False self.sc.set_account_config(acc) if acc.has_credentials(): keyring.get_keyring().store_credentials(acc, acc.get_credentials()) self.sc.save_accounts() self.emit("account-changed", acc)
def save_account(self, acc): acc.error_notified = False self.sc.set_account_config (acc) if acc.has_credentials(): keyring.get_keyring().store_credentials(acc, acc.get_credentials()) self.sc.save_accounts() self.emit("account-changed", acc)
def del_account(self, account, complete=True): del self.accounts[account.get_name()] if complete: self.sc.del_account_config(account.get_name()) if account.has_credentials(): keyring.get_keyring().remove_credentials(account) self.sc.save_accounts() self.emit("account-deleted", account)
def load_accounts(self): accs_conf = self.sc.get_accounts_config() for conf in accs_conf.values(): provider = self.pm.get_provider(conf['provider_name']) if provider: try: acc = provider.load_account (conf) if acc.has_credentials(): credentials = Credentials("","") try: credentials = keyring.get_keyring().get_credentials(acc) except Exception, e: logger.exception("Cannot load credentials for account "+conf["name"]+": %s", e) acc.set_credentials (credentials) self.add_account(acc) except Exception, e: logger.exception("Cannot load the account "+conf["name"]+": %s", e)
def check_auth_configuration(): try: import gnomekeyring as gk from ..core.keyrings import gkeyring except Exception: logger.debug("Gnome keyring is not available") return conf = SettingsController.get_instance() prefs = conf.get_prefs() if AUTH_DONT_ASK_KEY in prefs and get_boolean( prefs[AUTH_DONT_ASK_KEY]) == True: return if get_keyring().get_id() == gkeyring.GNOME_KEYRING_ID: return label = Gtk.Label() label.set_markup( _("""<b>Security warning</b> You have gnome-keyring installed but your are using plain text encryption to store your passwords. You can select the encryption method in the preferences dialog. """)) dialog = Gtk.Dialog( APP_LONG_NAME, None, Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT, (Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT)) dialog.set_icon(get_cloudsn_icon()) dialog.vbox.pack_start(label, False, False, 10) checkbox = Gtk.CheckButton(_("Don't ask me again")) checkbox.show() dialog.vbox.pack_end(checkbox, False, False, 0) label.show() response = dialog.run() dialog.destroy() if checkbox.get_active(): conf.set_pref(AUTH_DONT_ASK_KEY, True) conf.save_prefs()
def load_accounts(self): accs_conf = self.sc.get_accounts_config() for conf in accs_conf.values(): provider = self.pm.get_provider(conf['provider_name']) if provider: try: acc = provider.load_account(conf) if acc.has_credentials(): credentials = Credentials("", "") try: credentials = keyring.get_keyring( ).get_credentials(acc) except Exception, e: logger.exception( "Cannot load credentials for account " + conf["name"] + ": %s", e) acc.set_credentials(credentials) self.add_account(acc) except Exception, e: logger.exception( "Cannot load the account " + conf["name"] + ": %s", e)
def check_auth_configuration(): try: import gnomekeyring as gk from ..core.keyrings import gkeyring except Exception: logger.debug("Gnome keyring is not available") return conf = SettingsController.get_instance() prefs = conf.get_prefs() if AUTH_DONT_ASK_KEY in prefs and get_boolean(prefs[AUTH_DONT_ASK_KEY]) == True: return if get_keyring().get_id() == gkeyring.GNOME_KEYRING_ID: return label = Gtk.Label() label.set_markup(_("""<b>Security warning</b> You have gnome-keyring installed but your are using plain text encryption to store your passwords. You can select the encryption method in the preferences dialog. """)) dialog = Gtk.Dialog(APP_LONG_NAME, None, Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT, (Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT)) dialog.set_icon(get_cloudsn_icon()) dialog.vbox.pack_start(label, False, False, 10) checkbox = Gtk.CheckButton(_("Don't ask me again")) checkbox.show() dialog.vbox.pack_end(checkbox, False, False, 0) label.show() response = dialog.run() dialog.destroy() if checkbox.get_active(): conf.set_pref (AUTH_DONT_ASK_KEY, True) conf.save_prefs()
def save_accounts(self, store_credentials=True): if store_credentials and acc.has_credentials(): keyring.get_keyring().store_credentials(acc, acc.get_credentials()) self.sc.save_accounts()
def save_accounts(self, store_credentials = True): if store_credentials and acc.has_credentials(): keyring.get_keyring().store_credentials(acc, acc.get_credentials()) self.sc.save_accounts()