Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insert more than one digit #19

Open
waldyrious opened this issue Aug 23, 2015 · 0 comments
Open

Insert more than one digit #19

waldyrious opened this issue Aug 23, 2015 · 0 comments

Comments

@waldyrious
Copy link
Owner

Some sites require more than one digit, e.g. https://www.netemprego.gov.pt

The code should be something like:

var digits = p.charCodeAt(0);
var posNum = digits % p.length - (digits.toString().length - 1);
if (p.match(/\d/g).length < 2) { // if password doesn't contain at least two digits 
  p = p.replaceAt(posNum, digits);
}

This is basically what's already used to insert a single digit, but without the mod 10 to reduce the digits string (currently called "seed") to a single digit, and using its length (charcodes of base64 strings are the decimal codes of 0-9, A-Z, a-z, and the latter goes into 3 digits near z) in the posNum calculation.

This should already work, but the symbol insertion code would need to be adapted to ensure it doesn't overwrite the inserted digits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant