diff --git a/logsCodes.txt b/logsCodes.txt
index e463c05..84e0e35 100644
--- a/logsCodes.txt
+++ b/logsCodes.txt
@@ -69,6 +69,7 @@
36 - handleSafariReset
38 - storageValidationReload
45 - domainModalFormSubmit
+47 - handleImportDefaultExcludedDomains
// PARTIALS
*23 - openShortcutEdit [redundant]
diff --git a/src/_locales/en/optionsPage.json b/src/_locales/en/optionsPage.json
index fb31ef3..b90b6f0 100644
--- a/src/_locales/en/optionsPage.json
+++ b/src/_locales/en/optionsPage.json
@@ -11,7 +11,8 @@
"optionsAddAnotherDevice": "Add another device",
"optionsExcludedDomainsHeader": "Auto submit excluded domains:",
"optionsRemoveFromExcluded": "Remove from excluded",
- "optionsExcludeAnotherDomain": "Exclude another domain",
+ "optionsExcludeAnotherDomain": "Exclude domain",
+ "optionsExcludeImportDefault": "Import default list",
"optionsDomainModalHeader": "Exclude new domain",
"optionsDomainModalText": "With the form below, you can add your domain to exclusion list, ensuring it won't be subjected to the auto submit mechanism.",
"optionsDomainInputPlaceholder": "Type in domain to exclude...",
diff --git a/src/defaultAutoSubmitExcludedDomains.js b/src/defaultAutoSubmitExcludedDomains.js
index 7b05986..9a5382e 100644
--- a/src/defaultAutoSubmitExcludedDomains.js
+++ b/src/defaultAutoSubmitExcludedDomains.js
@@ -17,6 +17,17 @@
// along with this program. If not, see
//
-const defaultAutoSubmitExcludedDomains = [];
+const defaultAutoSubmitExcludedDomains = [
+ // Discourse problem
+ // https://github.com/twofas/2fas-browser-extension/issues/42
+ // https://meta.discourse.org/t/totp-modal-problem-cooperation-with-2fas-browser-extension/293760
+ 'community.bitwarden.com',
+ 'forum.torproject.org',
+ 'community.home-assistant.io',
+ 'meta.discourse.org',
+ 'forum.mssociety.org.uk',
+ 'forum.asana.com',
+ 'dev.epicgames.com'
+];
module.exports = defaultAutoSubmitExcludedDomains;
diff --git a/src/optionsPage/functions/handleImportDefaultExcludedDomains.js b/src/optionsPage/functions/handleImportDefaultExcludedDomains.js
new file mode 100644
index 0000000..5098bc6
--- /dev/null
+++ b/src/optionsPage/functions/handleImportDefaultExcludedDomains.js
@@ -0,0 +1,31 @@
+const { loadFromLocalStorage, saveToLocalStorage } = require('../../localStorage');
+const defaultAutoSubmitExcludedDomains = require('../../defaultAutoSubmitExcludedDomains');
+const uniqueOnly = require('../../partials/uniqueOnly');
+const generateDomainsList = require('./generateDomainsList');
+const TwoFasNotification = require('../../notification');
+const config = require('../../config');
+const storeLog = require('../../partials/storeLog');
+
+const handleImportDefaultExcludedDomains = e => {
+ e.preventDefault();
+ e.stopPropagation();
+
+ return loadFromLocalStorage(['autoSubmitExcludedDomains'])
+ .then(data => {
+ const currentExcludedDomains = data.autoSubmitExcludedDomains;
+ let newExcludedDomains = [...currentExcludedDomains, ...defaultAutoSubmitExcludedDomains];
+ newExcludedDomains = newExcludedDomains.filter(uniqueOnly);
+
+ return saveToLocalStorage({ autoSubmitExcludedDomains: newExcludedDomains }, {});
+ })
+ .then(res => {
+ generateDomainsList(res.autoSubmitExcludedDomains);
+ TwoFasNotification.show(config.Texts.Success.DomainExcluded);
+ })
+ .catch(async err => {
+ await storeLog('error', 47, err, 'handleImportDefaultExcludedDomains');
+ return TwoFasNotification.show(config.Texts.Error.UndefinedError, null, true);
+ });
+};
+
+module.exports = handleImportDefaultExcludedDomains;
diff --git a/src/optionsPage/functions/index.js b/src/optionsPage/functions/index.js
index 00a8c97..b996071 100644
--- a/src/optionsPage/functions/index.js
+++ b/src/optionsPage/functions/index.js
@@ -29,6 +29,7 @@ exports.generateShortcutLink = require('./generateShortcutLink');
exports.handleAdvancedHeaderClick = require('./handleAdvancedHeaderClick');
exports.handleContextMenuChange = require('./handleContextMenuChange');
exports.handleHamburgerClick = require('./handleHamburgerClick');
+exports.handleImportDefaultExcludedDomains = require('./handleImportDefaultExcludedDomains');
exports.handleLoggingChange = require('./handleLoggingChange');
exports.handleMenuLink = require('./handleMenuLink');
exports.handlePinInfo = require('./handlePinInfo');
@@ -50,6 +51,7 @@ exports.setExtNameUpdateForm = require('./setExtNameUpdateForm');
exports.setExtVersion = require('./setExtVersion');
exports.setPinInfoBtns = require('./setPinInfoBtns');
exports.setHamburger = require('./setHamburger');
+exports.setImportDefaultExcludedDomains = require('./setImportDefaultExcludedDomains');
exports.setLoggingToggle = require('./setLoggingToggle');
exports.setMenuLinks = require('./setMenuLinks');
exports.setModalsListeners = require('./setModalsListeners');
diff --git a/src/optionsPage/functions/setImportDefaultExcludedDomains.js b/src/optionsPage/functions/setImportDefaultExcludedDomains.js
new file mode 100644
index 0000000..d75c644
--- /dev/null
+++ b/src/optionsPage/functions/setImportDefaultExcludedDomains.js
@@ -0,0 +1,9 @@
+const S = require('../../selectors');
+const handleImportDefaultExcludedDomains = require('./handleImportDefaultExcludedDomains');
+
+const setImportDefaultExcludedDomains = () => {
+ const importDefaultListBtn = document.querySelector(S.optionsPage.autoSubmit.importDefault);
+ importDefaultListBtn.addEventListener('click', handleImportDefaultExcludedDomains);
+};
+
+module.exports = setImportDefaultExcludedDomains;
diff --git a/src/optionsPage/optionsPage.html b/src/optionsPage/optionsPage.html
index 1ec4867..8a2b41f 100644
--- a/src/optionsPage/optionsPage.html
+++ b/src/optionsPage/optionsPage.html
@@ -139,14 +139,26 @@
-
-
-
-
- Exclude another domain
-
+
diff --git a/src/optionsPage/optionsPage.js b/src/optionsPage/optionsPage.js
index 0a82629..6db95b4 100644
--- a/src/optionsPage/optionsPage.js
+++ b/src/optionsPage/optionsPage.js
@@ -25,7 +25,7 @@ const TwoFasNotification = require('../notification');
const SDK = require('../sdk');
const extPageOnMessage = require('../partials/extPageOnMessage');
const { delay, storeLog, handleTargetBlank, hidePreloader, storageValidation } = require('../partials');
-const { generateDevicesList, setLoggingToggle, setContextMenuToggle, setPushRadio, setPinInfo, setExtName, setExtNameUpdateForm, setModalsListeners, setAdvanced, setMenuLinks, setPinInfoBtns, setShortcutBox, setHamburger, setExtVersion, generateShortcutBox, generateShortcutLink, showIntegrityError, generateDomainsList } = require('./functions');
+const { generateDevicesList, setLoggingToggle, setContextMenuToggle, setPushRadio, setPinInfo, setExtName, setExtNameUpdateForm, setModalsListeners, setAdvanced, setMenuLinks, setPinInfoBtns, setShortcutBox, setHamburger, setExtVersion, generateShortcutBox, generateShortcutLink, showIntegrityError, generateDomainsList, setImportDefaultExcludedDomains } = require('./functions');
const init = async storage => {
i18n();
@@ -49,6 +49,7 @@ const init = async storage => {
return new SDK().getAllPairedDevices(storage.extensionID)
.then(generateDevicesList)
.then(() => generateDomainsList(storage.autoSubmitExcludedDomains))
+ .then(setImportDefaultExcludedDomains)
.then(setPinInfo)
.then(() => setExtName(storage.browserInfo.name))
.then(() => setExtNameUpdateForm(storage))
diff --git a/src/optionsPage/styles/_content.scss b/src/optionsPage/styles/_content.scss
index 3e2a29c..abb9648 100644
--- a/src/optionsPage/styles/_content.scss
+++ b/src/optionsPage/styles/_content.scss
@@ -460,6 +460,14 @@
padding-bottom: 10px;
}
}
+
+ &[colspan="2"] {
+ @media all and (max-width: 660px) {
+ &::before {
+ content: '';
+ }
+ }
+ }
}
}
}
@@ -533,6 +541,27 @@
}
}
+ &.import-default {
+ @media all and (max-width: 600px) {
+ flex-direction: row-reverse;
+ }
+
+ .twofas-options-page-content-auto-submit-excluded-domain-list-exclude-icon {
+ margin-left: 11px;
+ margin-right: 0;
+
+ @media all and (max-width: 600px) {
+ margin-left: 0;
+ margin-right: 11px;
+ }
+
+ svg {
+ height: 16px;
+ width: 16px;
+ }
+ }
+ }
+
&-icon {
align-items: center;
background-color: $theme-color;
@@ -562,6 +591,21 @@
transition: color .2s ease-in-out;
}
}
+
+ &-buttons {
+ display: flex;
+ flex-direction: row;
+ gap: 0 20px;
+ justify-content: space-between;
+ width: 100%;
+
+ @media all and (max-width: 600px) {
+ align-items: flex-start;
+ flex-direction: column;
+ gap: 20px 0;
+ justify-content: flex-start;
+ }
+ }
}
&-advanced {
diff --git a/src/selectors.js b/src/selectors.js
index 1dfb8fc..ebbfc04 100644
--- a/src/selectors.js
+++ b/src/selectors.js
@@ -78,7 +78,8 @@ const selectors = {
autoSubmit: {
list: '.js-twofas-auto-submit-excluded-domain-list',
exclude: '.js-twofas-auto-submit-excluded-domain-exclude',
- add: '.js-twofas-auto-submit-excluded-domain-add'
+ add: '.js-twofas-auto-submit-excluded-domain-add',
+ importDefault: '.js-twofas-auto-submit-excluded-domain-import-default'
},
menuLink: '.js-twofas-menu-link',
extVersion: 'span.twofas-ext-version',