Skip to content

Commit

Permalink
fix enableOTP handling to match docs: prioritize store, then extens…
Browse files Browse the repository at this point in the history
…ion config
  • Loading branch information
uninsane committed Nov 7, 2022
1 parent e342264 commit a5f5e27
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ async function handleMessage(settings, message, sendResponse) {
}
break;
case "copyOTP":
if (settings.enableOTP) {
if (helpers.getSetting("enableOTP", message.login, settings)) {
try {
if (!message.login.fields.otp) {
throw new Exception("No OTP seed available");
Expand Down Expand Up @@ -796,8 +796,8 @@ async function handleMessage(settings, message, sendResponse) {

// copy OTP token after fill
if (
settings.enableOTP &&
typeof message.login !== "undefined" &&
helpers.getSetting("enableOTP", message.login, settings) &&
message.login.fields.hasOwnProperty("otp")
) {
copyToClipboard(helpers.makeTOTP(message.login.fields.otp.params));
Expand Down Expand Up @@ -963,7 +963,7 @@ async function parseFields(settings, login) {
}

// preprocess otp
if (settings.enableOTP && login.fields.hasOwnProperty("otp")) {
if (helpers.getSetting("enableOTP", login, settings) && login.fields.hasOwnProperty("otp")) {
if (login.fields.otp.match(/^otpauth:\/\/.+/i)) {
// attempt to parse otp data as URI
try {
Expand Down
2 changes: 1 addition & 1 deletion src/popup/detailsInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function view(ctl, params) {
]),
(() => {
if (
this.settings.enableOTP &&
helpers.getSetting("enableOTP", login, this.settings) &&
login.fields.otp &&
login.fields.otp.params.type === "totp"
) {
Expand Down

0 comments on commit a5f5e27

Please sign in to comment.