Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
varjolintu committed Jan 27, 2024
1 parent 5a0e211 commit b773934
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions keepassxc-browser/content/totp-field.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,8 @@ class TOTPFieldIcon extends Icon {
}
}

TOTPFieldIcon.prototype.initField = async function(field, segmented) {
// Observer the visibility
if (this.observer) {
this.observer.observe(field);
}

this.createIcon(field, segmented);
this.inputField = field;

// Fill TOTP automatically if option is enabled
// Fill TOTP automatically if option is enabled
TOTPFieldIcon.prototype.autoFillSingleTotp = async function(field) {
if (kpxc.settings.autoFillSingleTotp) {
if (kpxc.credentials.length === 0) {
await kpxc.receiveCredentialsIfNecessary();
Expand All @@ -129,6 +121,18 @@ TOTPFieldIcon.prototype.initField = async function(field, segmented) {
}
};

TOTPFieldIcon.prototype.initField = async function(field, segmented) {
// Observer the visibility
if (this.observer) {
this.observer.observe(field);
}

this.createIcon(field, segmented);
this.inputField = field;

await this.autoFillSingleTotp(field);
};

TOTPFieldIcon.prototype.createIcon = function(field, segmented = false) {
const className = (isFirefox() ? 'moz' : 'default');

Expand Down

0 comments on commit b773934

Please sign in to comment.