Example #1
0
    def SetDisplayName(self, profile_id, new_display_name):
        #Get info
        info = gk.item_get_info_sync(self.keyring_name, profile_id)
        attributes = self.GetAttributes(profile_id)

        #Change info
        info.set_display_name(new_display_name)

        #Update info
        gk.item_set_info_sync(self.keyring_name, profile_id, info)
        gk.item_set_attributes_sync(self.keyring_name, profile_id, attributes)
Example #2
0
			def close_button_pressed(x, y):
				try:
					if keyring_data['id'] and keyring_data['item']:
						# The async version is not in the python bindings, grr...
						keyring.item_set_info_sync(None, keyring_data['id'], keyring_data['item'])
					else:
						rb.error_dialog(title = _("Couldn't store account information"),
						                message = _("There was a problem accessing the keyring. Check the debug output for more information."))
				except Exception, e:
					rb.error_dialog(title = _("Couldn't store account information"),
					                message = str(e))
Example #3
0
    def SetPassword(self, profile_id, new_password):
        #Get info
        info = gk.item_get_info_sync(self.keyring_name, profile_id)
        attributes = self.GetAttributes(profile_id)

        #Change info
        info.set_secret(new_password.encode('ascii', 'ignore'))

        #Update info
        gk.item_set_info_sync(self.keyring_name, profile_id, info)
        gk.item_set_attributes_sync(self.keyring_name, profile_id, attributes)
def set_credentials(email, password):
    item_id = get_item_id()
    
    info = gk.ItemInfo()
    info.set_display_name(_display_name)
    info.set_type(_type)
    info.set_secret(password)
    gk.item_set_info_sync(_keyring, item_id, info)
    
    attrs = _attrs.copy()
    attrs['email'] = email
    gk.item_set_attributes_sync(_keyring, item_id, attrs)
Example #5
0
def set_credentials(email, password):
    item_id = get_item_id()

    info = gk.ItemInfo()
    info.set_display_name(_display_name)
    info.set_type(_type)
    info.set_secret(password)
    gk.item_set_info_sync(_keyring, item_id, info)

    attrs = _attrs.copy()
    attrs['email'] = email
    gk.item_set_attributes_sync(_keyring, item_id, attrs)
 def close_button_pressed(self, dialog, response):
     if response != gtk.RESPONSE_CLOSE:
         return
     username = self.__builder.get_object("username").get_text()
     password = self.__builder.get_object("password").get_text()
     # TODO: Verify Account
     if self.__keyring_data['item']:
         self.__keyring_data['item'].set_secret('\n'.join((username, password)))
     keyring.item_set_info_sync(None, self.__keyring_data['id'], self.__keyring_data['item'])
     dialog.hide()
     
     if self.callback:
         self.callback()
         self.callback = None
Example #7
0
 def close_button_pressed(x, y):
     try:
         if keyring_data['id'] and keyring_data['item']:
             # The async version is not in the python bindings, grr...
             keyring.item_set_info_sync(None, keyring_data['id'],
                                        keyring_data['item'])
         else:
             RB.error_dialog(
                 title=_("Couldn't store account information"),
                 message=
                 _("There was a problem accessing the keyring. Check the debug output for more information."
                   ))
     except Exception, e:
         RB.error_dialog(title=_("Couldn't store account information"),
                         message=str(e))
Example #8
0
	def change_secret(self, entry_id, secret):
		"""Change secret for selected entry"""
		if not self.keyring_exists():
			raise InvalidKeyringError('Keyring does not exist!')

		result = False

		# if keyring is locked, try to unlock it
		if self.is_locked() and not self.__unlock_keyring():
			return result

		# get entry information
		info = keyring.item_get_info_sync(self.KEYRING_NAME, entry_id)

		if info is not None:
			info.set_secret(secret)
			keyring.item_set_info_sync(self.KEYRING_NAME, entry_id, info)
			result = True

		return result
Example #9
0
	def rename_entry(self, entry, new_name):
		"""Rename entry"""
		if not self.keyring_exists():
			raise InvalidKeyringError('Keyring does not exist!')

		result = False

		# if keyring is locked, try to unlock it
		if self.is_locked() and not self.__unlock_keyring():
			return result

		# get entry information
		entry_id = self.__get_entry_id(entry)
		info = keyring.item_get_info_sync(self.KEYRING_NAME, entry_id)

		if info is not None:
			info.set_display_name(new_name)
			keyring.item_set_info_sync(self.KEYRING_NAME, entry_id, info)
			result = True

		return result
    def close_button_pressed(self, dialog, response):
        if response != gtk.RESPONSE_CLOSE:
            return
        username = self.__builder.get_object("username").get_text()
        password = self.__builder.get_object("password").get_text()
        # TODO: Verify Account
        if self.__keyring_data['item']:
            self.__keyring_data['item'].set_secret('\n'.join((username, password)))
        keyring.item_set_info_sync(None, self.__keyring_data['id'], self.__keyring_data['item'])

	enable_icon = self.__builder.get_object("enable_icon")
	enabled =enable_icon.get_active()
	self.gconf.set_bool(GCONF_KEYS['icon'], enabled)
	print "Setting to "
	print enabled

        dialog.hide()
        
        if self.callback:
	    #gconf transaction is asynch
            self.callback(enabled)
#! /usr/bin/python

import gobject
import gnomekeyring as keyring

from optparse import OptionParser
parser = OptionParser(add_help_option=False)
parser.add_option("-o", "--old", dest="old",
                  help="The old password", metavar="PASSWORD")
parser.add_option("-n", "--new", dest="new",
                  help="The new password", metavar="PASSWORD")
parser.add_option("-?", "--help", action="help", help="show this help message and exit")

(options, args) = parser.parse_args()
if options.old is None or options.new is None:
    parser.error("You must provide old and new passwords")
    
gobject.set_application_name("keyring-utils")

for item_id in keyring.list_item_ids_sync("login"):
    item = keyring.item_get_info_sync("login", item_id)
    if item.get_secret() == options.old:
        print item.get_display_name()
        item.set_secret(options.new)
        keyring.item_set_info_sync("login", item_id, item)
Example #12
0
	def __set_pwd(self, pwd, item):
		""" Set the password of the account details """
		info = gk.item_get_info_sync(self.NAME, item)
		info.set_secret(pwd)
		gk.item_set_info_sync(self.NAME, item, info)