Skip to content

Commit

Permalink
Merge pull request #3951 from Shritesh99/bugfix/3777
Browse files Browse the repository at this point in the history
Fixed domain, username & password extraction logic for URLs.
  • Loading branch information
VishalNehra authored Nov 5, 2023
2 parents 10d8b5b + bb98d03 commit 896c4e0
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,18 @@ public void afterTextChanged(@NonNull Editable s) {
int domainDelim = !inf.contains(";") ? 0 : inf.indexOf(';');
domainp = inf.substring(0, domainDelim);
if (domainp != null && domainp.length() > 0) inf = inf.substring(domainDelim + 1);
userp = inf.substring(0, inf.indexOf(":"));
try {
passp =
PasswordUtil.INSTANCE.decryptPassword(
context, inf.substring(inf.indexOf(COLON) + 1), URL_SAFE);
passp = decode(passp, Charsets.UTF_8.name());
} catch (GeneralSecurityException | IOException e) {
LOG.warn("Error decrypting password", e);
passp = "";
if (!inf.contains(":")) userp = inf;
else {
userp = inf.substring(0, inf.indexOf(COLON));
try {
passp =
PasswordUtil.INSTANCE.decryptPassword(
context, inf.substring(inf.indexOf(COLON) + 1), URL_SAFE);
passp = decode(passp, Charsets.UTF_8.name());
} catch (GeneralSecurityException | IOException e) {
LOG.warn("Error decrypting password", e);
passp = "";
}
}
domain.setText(domainp);
user.setText(userp);
Expand Down

0 comments on commit 896c4e0

Please sign in to comment.