mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-13 19:51:37 +01:00
Adjust autofill to handle sites with no username/password
This commit is contained in:
parent
6b3416a367
commit
9e2b64d0c4
@ -336,39 +336,45 @@ function buildContextMenuOptions(url) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function loadSiteContextMenuOptions(site) {
|
function loadSiteContextMenuOptions(site) {
|
||||||
var title = site.name + ' (' + site.username + ')';
|
var title = site.name + (site.username && site.username !== '' ? ' (' + site.username + ')' : '');
|
||||||
loadContextMenuOptions(title, site.id);
|
loadContextMenuOptions(title, site.id, site);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadNoSitesContextMenuOptions() {
|
function loadNoSitesContextMenuOptions() {
|
||||||
var title = 'No matching sites.';
|
var title = 'No matching sites.';
|
||||||
loadContextMenuOptions(title, 'noop');
|
loadContextMenuOptions(title, 'noop', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadContextMenuOptions(title, idSuffix) {
|
function loadContextMenuOptions(title, idSuffix, site) {
|
||||||
chrome.contextMenus.create({
|
if (site.password && site.password !== '') {
|
||||||
type: 'normal',
|
chrome.contextMenus.create({
|
||||||
id: 'autofill_' + idSuffix,
|
type: 'normal',
|
||||||
parentId: 'autofill',
|
id: 'autofill_' + idSuffix,
|
||||||
contexts: ['all'],
|
parentId: 'autofill',
|
||||||
title: title
|
contexts: ['all'],
|
||||||
});
|
title: title
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
chrome.contextMenus.create({
|
if (site.username && site.username !== '') {
|
||||||
type: 'normal',
|
chrome.contextMenus.create({
|
||||||
id: 'copy-username_' + idSuffix,
|
type: 'normal',
|
||||||
parentId: 'copy-username',
|
id: 'copy-username_' + idSuffix,
|
||||||
contexts: ['all'],
|
parentId: 'copy-username',
|
||||||
title: title
|
contexts: ['all'],
|
||||||
});
|
title: title
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
chrome.contextMenus.create({
|
if (site.password && site.password !== '') {
|
||||||
type: 'normal',
|
chrome.contextMenus.create({
|
||||||
id: 'copy-password_' + idSuffix,
|
type: 'normal',
|
||||||
parentId: 'copy-password',
|
id: 'copy-password_' + idSuffix,
|
||||||
contexts: ['all'],
|
parentId: 'copy-password',
|
||||||
title: title
|
contexts: ['all'],
|
||||||
});
|
title: title
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyToClipboard(text) {
|
function copyToClipboard(text) {
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<span class="item-label">Name</span>
|
<span class="item-label">Name</span>
|
||||||
{{site.name}}
|
{{site.name}}
|
||||||
</div>
|
</div>
|
||||||
<div class="list-section-item" ng-show="site.uri">
|
<div class="list-section-item" ng-if="site.uri">
|
||||||
<a class="btn-list" href="" title="Launch Website" ng-click="launchWebsite(site)"
|
<a class="btn-list" href="" title="Launch Website" ng-click="launchWebsite(site)"
|
||||||
ng-show="site.showLaunch">
|
ng-show="site.showLaunch">
|
||||||
<i class="fa fa-lg fa-share-square-o"></i>
|
<i class="fa fa-lg fa-share-square-o"></i>
|
||||||
@ -26,7 +26,7 @@
|
|||||||
<span class="item-label">Website</span>
|
<span class="item-label">Website</span>
|
||||||
{{site.website}}
|
{{site.website}}
|
||||||
</div>
|
</div>
|
||||||
<div class="list-section-item" ng-show="site.username">
|
<div class="list-section-item" ng-if="site.username">
|
||||||
<a class="btn-list" href="" title="Copy Username" ngclipboard ngclipboard-error="clipboardError(e)"
|
<a class="btn-list" href="" title="Copy Username" ngclipboard ngclipboard-error="clipboardError(e)"
|
||||||
ngclipboard-success="clipboardSuccess(e, 'Username')" data-clipboard-target="#username">
|
ngclipboard-success="clipboardSuccess(e, 'Username')" data-clipboard-target="#username">
|
||||||
<i class="fa fa-lg fa-clipboard"></i>
|
<i class="fa fa-lg fa-clipboard"></i>
|
||||||
@ -34,7 +34,7 @@
|
|||||||
<span class="item-label">Username</span>
|
<span class="item-label">Username</span>
|
||||||
<span id="username" class="monospaced">{{site.username}}</span>
|
<span id="username" class="monospaced">{{site.username}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="list-section-item" ng-show="site.password">
|
<div class="list-section-item" ng-if="site.password">
|
||||||
<a class="btn-list" href="" title="Copy Password" ngclipboard ngclipboard-error="clipboardError(e)"
|
<a class="btn-list" href="" title="Copy Password" ngclipboard ngclipboard-error="clipboardError(e)"
|
||||||
ngclipboard-success="clipboardSuccess(e, 'Password')" data-clipboard-target="#password">
|
ngclipboard-success="clipboardSuccess(e, 'Password')" data-clipboard-target="#password">
|
||||||
<i class="fa fa-lg fa-clipboard"></i>
|
<i class="fa fa-lg fa-clipboard"></i>
|
||||||
@ -48,7 +48,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="list-section" ng-show="site.notes">
|
<div class="list-section" ng-if="site.notes">
|
||||||
<div class="list-section-header">
|
<div class="list-section-header">
|
||||||
Notes
|
Notes
|
||||||
</div>
|
</div>
|
||||||
|
@ -6,6 +6,10 @@
|
|||||||
@import "plugins.less";
|
@import "plugins.less";
|
||||||
@import "pages.less";
|
@import "pages.less";
|
||||||
|
|
||||||
|
html {
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
width: 320px !important;
|
width: 320px !important;
|
||||||
height: 568px !important;
|
height: 568px !important;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
function initAutofill() {
|
function initAutofill() {
|
||||||
AutofillService.prototype.generateFillScript = function (pageDetails, fillUsername, fillPassword) {
|
AutofillService.prototype.generateFillScript = function (pageDetails, fillUsername, fillPassword) {
|
||||||
if (!pageDetails) {
|
if (!pageDetails || !fillPassword || fillPassword === '') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user