Add tab to ignore page / site. Fixes #146

This commit is contained in:
brantje 2017-08-05 12:10:47 +02:00
Родитель f6628525f5
Коммит b6c348890b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 5FF1D117F918687F
7 изменённых файлов: 95 добавлений и 23 удалений

Просмотреть файл

@ -223,6 +223,10 @@
"message": "Site ignored",
"description": "Site ignored"
},
"url_ignored": {
"message": "URL ignored",
"description": "URL ignored"
},
"update": {
"message": "Update",
"description": "Update"
@ -364,9 +368,21 @@
"description": "Select default vault"
},
"ignored_sites": {
"message": "Ignored sites",
"message": "Ignored sites / urls",
"description": "Ignored sites"
},
"disable_page": {
"message": "Disable page",
"description": "Disable page"
},
"disable_site": {
"message": "Disable site",
"description": "Disable site"
},
"disable_picker_text": {
"message": "Would you like to disable Passman for the current page, or for the entire website?",
"description": "Would you like to disable Passman for the current page, or for the entire website?"
},
"no_sites_ignored": {
"message": "No sites ignored",
"description": "No sites ignored"
@ -383,6 +399,10 @@
"message": "Invalid server URL",
"description": "Invalid server URL"
},
"ignore_site_tab": {
"message": "Ignore site / page",
"description": "Invalid server URL"
},
"no_password_match": {
"message": "Passwords don't match",
"description": "When comparing passwords"

Просмотреть файл

@ -50,7 +50,8 @@ small {
color: #e1e1e1; }
#password_picker .tabs .tab.close {
float: right;
margin-top: -1px;
margin-top: -6px;
padding: 11px 10px;
border-left: 1px solid #1572b9; }
#password_picker div {
box-sizing: content-box; }
@ -69,7 +70,7 @@ small {
font-size: 13px;
box-sizing: content-box;
background-clip: padding-box; }
#password_picker input[type="password"], #password_picker input[type="text"]:not(#savepw-password), #password_picker select {
#password_picker input[type="password"], #password_picker input[type="text"]:not(#savepw-password) {
width: calc(100% - 24px) !important; }
#password_picker input[type="password"], #password_picker #savepw-password {
width: calc(100% - 75px) !important;

Просмотреть файл

@ -15,6 +15,7 @@
<script src="/js/vendor/sjcl/sjcl.js"></script>
<script src="/js/lib/passwordgen.js"></script>
<link href="/css/vendor/bootstrap.css" media="all" rel="stylesheet"/>
<script src="/js/ui/password_picker/password_picker.js"></script>
<link href="/css/vendor/font-awesome.css" media="all" rel="stylesheet"/>
<link href="/css/password_picker.css" media="all" rel="stylesheet"/>
@ -25,8 +26,8 @@
<div class="tab add" data-name="add"><span class="fa fa-plus" aria-hidden="true" t="[add_account, title]"></span></div>
<div class="tab list active" data-name="list"><span class="fa fa-list" aria-hidden="true" t="[accounts, title]"></span></div>
<div class="tab search" data-name="search"><span class="fa fa-search" aria-hidden="true" t="[search, title]"></span></div>
<div class="tab generate" data-name="generate"><span class="fa fa-refresh" aria-hidden="true" t="[password_generator, title]"></span>
</div>
<div class="tab generate" data-name="generate"><span class="fa fa-refresh" aria-hidden="true" t="[password_generator, title]"></span></div>
<div class="tab ignore" data-name="ignore"><span class="fa fa-ban" aria-hidden="true" t="[ignore_site_tab, title]"></span></div>
<div class="tab close pull-right"><span class="fa fa-times" aria-hidden="true" t="[close, title]" title="Close"></span></div>
</div>
<div class="tab-content">
@ -144,6 +145,16 @@
</form>
</div>
</div>
</div>
<div class="tab-ignore-content">
<h2 t="ignore_site"></h2>
<div class="text">
<div style="line-height: 1.5em" t="disable_picker_text"></div>
<hr>
<div class="btn btn-warning disable-site" t="disable_site">Disable site</div>
<div class="btn btn-info disable-page" t="disable_page">Disable page</div>
</div>
</div>
</div>
</div>

Просмотреть файл

@ -246,24 +246,28 @@ $j(document).ready(function () {
var enablePasswordPicker = settings.enablePasswordPicker;
var url = window.location.href;
var loginFields = getLoginFields();
if (!settings.hasOwnProperty('ignored_sites') || settings.ignored_sites.findUrl(url).length !== 0) {
return;
}
if (loginFields.length > 0) {
for (var i = 0; i < loginFields.length; i++) {
var form = getFormFromElement(loginFields[i][0]);
if (enablePasswordPicker) {
createPasswordPicker(loginFields[i], form);
}
//Password miner
/* jshint ignore:start */
if (!settings.hasOwnProperty('ignored_sites') || settings.ignored_sites.findUrl(url) !== -1) {
if (enablePasswordPicker) {
createPasswordPicker(loginFields[i], form);
}
//Password miner
/* jshint ignore:start */
$j(form).submit((function (loginFields) {
return function () {
formSubmitted(loginFields);
};
})(loginFields[i]));
}
/* jshint ignore:end */
/* jshint ignore:end */
}
API.runtime.sendMessage(API.runtime.id, {
method: "getCredentialsByUrl",
args: url

Просмотреть файл

@ -94,9 +94,9 @@ var background = (function () {
}
if (!_self.settings.hasOwnProperty('enablePasswordPicker')) {
_self.settings.enablePasswordPicker = !_self.settings.disablePasswordPicker ;
_self.settings.enablePasswordPicker = !_self.settings.disablePasswordPicker;
}
if (!_self.settings.hasOwnProperty('enableAutoFill')) {
_self.settings.enableAutoFill = !_self.settings.disableAutoFill;
}
@ -154,7 +154,7 @@ var background = (function () {
_self.saveSettings = saveSettings;
function resetSettings(){
function resetSettings() {
storage.set('settings', {});
_self.settings = {};
}
@ -243,16 +243,16 @@ var background = (function () {
if (!_url || _url === '') {
return [];
}
if(Array.isArray(_url)){
if (Array.isArray(_url)) {
_url = _url.pop();
}
var p = document.createElement('a');
p.href = _url;
if(p.pathname) {
if (p.pathname) {
//_url = _url.substring(0, _url.lastIndexOf("/"));
}
var url = processURL(_url, _self.settings.ignoreProtocol, _self.settings.ignoreSubdomain, _self.settings.ignorePath, _self.settings.ignorePort);
var found_list = [];
for (var i = 0; i < local_credentials.length; i++) {
@ -261,7 +261,7 @@ var background = (function () {
try {
var protocol = _url.split('://').shift();
credential_url = protocol + "://" + credential_url;
} catch (e){
} catch (e) {
//ignore
}
}
@ -403,7 +403,7 @@ var background = (function () {
if (!_self.settings.hasOwnProperty('ignored_sites')) {
_self.settings.ignored_sites = [];
}
var site = processURL(_url, _self.settings.ignoreProtocol, _self.settings.ignoreSubdomain, _self.settings.ignorePath, _self.settings.ignorePort);
var site = processURL(_url, false, false, true, false);
if (_self.settings.ignored_sites.indexOf(site) === -1) {
_self.settings.ignored_sites.push(site);
saveSettings(_self.settings);
@ -412,6 +412,18 @@ var background = (function () {
_self.ignoreSite = ignoreSite;
function ignoreURL(url) {
if (!_self.settings.hasOwnProperty('ignored_sites')) {
_self.settings.ignored_sites = [];
}
if (_self.settings.ignored_sites.indexOf(url) === -1) {
_self.settings.ignored_sites.push(url);
saveSettings(_self.settings);
}
}
_self.ignoreURL = ignoreURL;
function passToParent(args, sender) {
API.tabs.sendMessage(sender.tab.id, {method: args.injectMethod, args: args.args}).then(function (response) {
});
@ -485,7 +497,7 @@ var background = (function () {
});
} else {
credential.label = sender.tab.title;
credential.vault_id = credential.account.vault.vault_id;
credential.vault_id = credential.account.vault.vault_id;
PAPI.createCredential(credential.account, credential, credential.account.vault_password, function (createdCredential) {
createdCredential.account = credential.account;
saveMinedCallback({credential: credential, updated: false, sender: sender});

Просмотреть файл

@ -230,9 +230,32 @@ $(document).ready(function () {
});
function disablePassman(where, url){
var whereFn = (where === 'site') ? 'Site' : 'URL';
API.runtime.sendMessage(API.runtime.id, {
method: "ignore"+ whereFn,
args: url
}).then(function () {
var text = (where === 'site') ? 'site_ignored' : 'url_ignored';
$('.tab-ignore-content').find('.text').text(API.i18n.getMessage(text));
setTimeout(function () {
removePasswordPicker();
}, 2500);
});
}
API.runtime.sendMessage(API.runtime.id, {method: "getActiveTab", args: {returnFn: "returnActiveTab"}});
function returnActiveTab(tab) {
$('.disable-site').on('click', function () {
disablePassman('site', tab.url);
});
$('.disable-page').on('click', function () {
disablePassman('url', tab.url);
});
API.runtime.sendMessage(API.runtime.id, {
method: "getCredentialsByUrl",
args: [tab.url]

Просмотреть файл

@ -70,7 +70,8 @@ small {
}
&.close {
float: right;
margin-top: -1px;
margin-top: -6px;
padding: 11px 10px;
border-left: 1px solid #1572b9;
}
}