Giter Club home page Giter Club logo

Comments (1)

RoelVB avatar RoelVB commented on July 21, 2024 1

Sometime you have to "redetect fields" using the right-click menu or the keyboardshortcut.
I've tested this with Instagram and Twitter and it works fine.

I appreciate you wanting to contribute. This is how the detection flow is now:
The content_script calls the detectFields() method after the page is loaded:

$(document).ready(()=>{
pageControl.detectFields();
});

Then the PageControl class tries to find credential fields:

public detectFields()
{
const fieldSets: FieldSet[] = [];
let passwordFields: JQuery<HTMLElement> = $('input[type="password"]');
if(passwordFields.length) // Found some password fields?
{
passwordFields.each((passwordIndex, passwordField)=>{ // Loop through password fields
let prevField: JQuery<HTMLElement>;
$('input').each((inputIndex, input)=>{ // Loop through input fields to find the field before our password field
const inputType = $(input).attr('type') || 'text'; // Get input type, if none default to "text"
if(inputType != 'password') // We didn't reach our password field?
{
if($(input).is(':visible') && (inputType === 'text' || inputType === 'email' || inputType === 'tel')) // Is this a possible username field?
prevField = $(input);
}
else if($(input).is($(passwordField))) // Found our password field?
{
if(prevField) // Is there a previous field? Than this should be our username field
{
fieldSets.push(new FieldSet(this, $(passwordField), prevField));
return; // Break the each() loop
}
else if($(input).is(':visible')) // We didn't find the username field. Check if it's actually visible
{
fieldSets.push(new FieldSet(this, $(passwordField)));
return; // Break the each() loop
}
else // We didn't find a visible username of password field
return;
}
});
});
}
// Remember the fields we've found
this._fieldSets = fieldSets;
this._findCredentials();
this._attachEscapeEvent();
}

from chromekeepass.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.