pfn / passifox

Extensions to allow Chrome and Firefox (4.0+) to auto form-fill passwords from KeePass (requires KeePassHttp)
GNU General Public License v3.0
903 stars 185 forks source link

chromeIPass search for partial match #696

Open pmolensky opened 5 years ago

pmolensky commented 5 years ago

I'm missing an option where the search would return all results where part of the username/title matches the typed characters (*searchstring*). And not only results, starting at position 1 (searchstring*)

I was looking at the code and I found the jQuery.autocomplete (v1.11) widget is used. By default this widget should return any matching entry: https://api.jqueryui.com/1.10/autocomplete/ source: https://api.jqueryui.com/1.10/autocomplete/

But I can't seem to find where the cIPJQ and jQuery differ and create a PR. I tried to compare the unminified sources from cIPJQ and jQuery, but due to all the minified function- and variablenames, it's hard to compare. Or am I looking at the wrong files?

Any suggestions?

pmolensky commented 5 years ago

UPDATE I found it was not related to jQueryUI. But the function cipAutocomplete.onSource did a search on index equal to zero. Changing the check to greater or equal to zero allows for wildcard searches.

cipAutocomplete.onSource = function (request, callback) {
    var matches = cIPJQ.map( cipAutocomplete.elements, function(tag) {
        if ( tag.label.toUpperCase().indexOf(request.term.toUpperCase()) >= 0 ) {
            return tag;
        }
    });
    callback(matches);
}

Is there a deliberate reason for making the index=0-check? Otherwise I'll make this into a PR. I'll try and make this change conditional and create a setting in the options page to allow for both strict/username only searches or any part of the KeePass entry.