public override bool Get (URIish uri, params CredentialItem[] items)
		{
			bool result = false;
			CredentialItem.Password passwordItem = null;
			CredentialItem.StringType passphraseItem = null;
			
			// We always need to run the TryGet* methods as we need the passphraseItem/passwordItem populated even
			// if the password store contains an invalid password/no password
			if (TryGetUsernamePassword (uri, items, out passwordItem) || TryGetPassphrase (uri, items, out passphraseItem)) {
				// If the password store has a password and we already tried using it, it could be incorrect.
				// If this happens, do not return true and ask the user for a new password.
				if (!HasReset) {
					return true;
				}
			}

			DispatchService.GuiSyncDispatch (delegate {
				CredentialsDialog dlg = new CredentialsDialog (uri, items);
				try {
					result = MessageService.ShowCustomDialog (dlg) == (int)Gtk.ResponseType.Ok;
				} finally {
					dlg.Destroy ();
				}
			});
				
			HasReset = false;
			if (result) {
				if (passwordItem != null) {
					PasswordService.AddWebPassword (new Uri (uri.ToString ()), new string (passwordItem.GetValue ()));
				} else if (passphraseItem != null) {
					PasswordService.AddWebPassword (new Uri (uri.ToString ()), passphraseItem.GetValue ());
				}
			}
			return result;
		}
Example #2
0
		public override bool Get (URIish uri, params CredentialItem[] items)
		{
			bool result = false;
			DispatchService.GuiSyncDispatch (delegate {
				CredentialsDialog dlg = new CredentialsDialog (uri, items);
				try {
					result = MessageService.ShowCustomDialog (dlg) == (int)Gtk.ResponseType.Ok;
				} finally {
					dlg.Destroy ();
				}
			});
			return result;
		}
Example #3
0
        public override bool Get(URIish uri, params CredentialItem[] items)
        {
            bool result = false;

            DispatchService.GuiSyncDispatch(delegate {
                CredentialsDialog dlg = new CredentialsDialog(uri, items);
                try {
                    result = MessageService.ShowCustomDialog(dlg) == (int)Gtk.ResponseType.Ok;
                } finally {
                    dlg.Destroy();
                }
            });
            return(result);
        }
Example #4
0
        public override bool Get(URIish uri, params CredentialItem[] items)
        {
            bool result = false;

            CredentialItem.Password   passwordItem   = null;
            CredentialItem.StringType passphraseItem = null;

            // We always need to run the TryGet* methods as we need the passphraseItem/passwordItem populated even
            // if the password store contains an invalid password/no password
            if (TryGetUsernamePassword(uri, items, out passwordItem) || TryGetPassphrase(uri, items, out passphraseItem))
            {
                // If the password store has a password and we already tried using it, it could be incorrect.
                // If this happens, do not return true and ask the user for a new password.
                if (!HasReset)
                {
                    return(true);
                }
            }

            DispatchService.GuiSyncDispatch(delegate
            {
                CredentialsDialog dlg = new CredentialsDialog(uri, items);
                try
                {
                    result = MessageService.ShowCustomDialog(dlg) == (int)Gtk.ResponseType.Ok;
                }
                finally
                {
                    dlg.Destroy();
                }
            });

            HasReset = false;
            if (result)
            {
                if (passwordItem != null)
                {
                    PasswordService.AddWebPassword(new Uri(uri.ToString()), new string (passwordItem.GetValue()));
                }
                else if (passphraseItem != null)
                {
                    PasswordService.AddWebPassword(new Uri(uri.ToString()), passphraseItem.GetValue());
                }
            }
            return(result);
        }