Compare commits
4 Commits
sane/dev
...
temp/debug
Author | SHA1 | Date | |
---|---|---|---|
284d9b2efc | |||
f70e0cc838 | |||
73a405c008 | |||
4c7d3533a3 |
@@ -724,7 +724,7 @@ async function handleMessage(settings, message, sendResponse) {
|
||||
}
|
||||
break;
|
||||
case "copyOTP":
|
||||
if (helpers.getSetting("enableOTP", message.login, settings, helpers.SettingScope.Store)) {
|
||||
if (settings.enableOTP) {
|
||||
try {
|
||||
if (!message.login.fields.otp) {
|
||||
throw new Exception("No OTP seed available");
|
||||
@@ -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, helpers.SettingScope.Store) &&
|
||||
message.login.fields.hasOwnProperty("otp")
|
||||
) {
|
||||
copyToClipboard(helpers.makeTOTP(message.login.fields.otp.params));
|
||||
@@ -963,10 +963,7 @@ async function parseFields(settings, login) {
|
||||
}
|
||||
|
||||
// preprocess otp
|
||||
if (
|
||||
helpers.getSetting("enableOTP", login, settings, helpers.SettingScope.Store) &&
|
||||
login.fields.hasOwnProperty("otp")
|
||||
) {
|
||||
if (settings.enableOTP && login.fields.hasOwnProperty("otp")) {
|
||||
if (login.fields.otp.match(/^otpauth:\/\/.+/i)) {
|
||||
// attempt to parse otp data as URI
|
||||
try {
|
||||
|
@@ -8,13 +8,6 @@ const hash = require("hash.js");
|
||||
const Authenticator = require("otplib").authenticator.Authenticator;
|
||||
const BrowserpassURL = require("@browserpass/url");
|
||||
|
||||
const SettingScope = {
|
||||
// query a setting first from the login, then the store, then globally
|
||||
Login: "login",
|
||||
// query a setting first from the store, then globally
|
||||
Store: "store",
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
prepareLogins,
|
||||
filterSortLogins,
|
||||
@@ -24,6 +17,13 @@ module.exports = {
|
||||
SettingScope,
|
||||
};
|
||||
|
||||
const SettingScope = {
|
||||
// query a setting first from the login, then the store, then globally
|
||||
Login: "login",
|
||||
// query a setting first from the store, then globally
|
||||
Store: "store",
|
||||
};
|
||||
|
||||
//----------------------------------- Function definitions ----------------------------------//
|
||||
|
||||
/**
|
||||
|
@@ -103,7 +103,7 @@ function view(ctl, params) {
|
||||
]),
|
||||
(() => {
|
||||
if (
|
||||
helpers.getSetting("enableOTP", login, this.settings, helpers.SettingScope.Store) &&
|
||||
this.settings.enableOTP &&
|
||||
login.fields.otp &&
|
||||
login.fields.otp.params.type === "totp"
|
||||
) {
|
||||
|
Reference in New Issue
Block a user