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) {
|
||||
var title = site.name + ' (' + site.username + ')';
|
||||
loadContextMenuOptions(title, site.id);
|
||||
var title = site.name + (site.username && site.username !== '' ? ' (' + site.username + ')' : '');
|
||||
loadContextMenuOptions(title, site.id, site);
|
||||
}
|
||||
|
||||
function loadNoSitesContextMenuOptions() {
|
||||
var title = 'No matching sites.';
|
||||
loadContextMenuOptions(title, 'noop');
|
||||
loadContextMenuOptions(title, 'noop', null);
|
||||
}
|
||||
|
||||
function loadContextMenuOptions(title, idSuffix) {
|
||||
chrome.contextMenus.create({
|
||||
type: 'normal',
|
||||
id: 'autofill_' + idSuffix,
|
||||
parentId: 'autofill',
|
||||
contexts: ['all'],
|
||||
title: title
|
||||
});
|
||||
function loadContextMenuOptions(title, idSuffix, site) {
|
||||
if (site.password && site.password !== '') {
|
||||
chrome.contextMenus.create({
|
||||
type: 'normal',
|
||||
id: 'autofill_' + idSuffix,
|
||||
parentId: 'autofill',
|
||||
contexts: ['all'],
|
||||
title: title
|
||||
});
|
||||
}
|
||||
|
||||
chrome.contextMenus.create({
|
||||
type: 'normal',
|
||||
id: 'copy-username_' + idSuffix,
|
||||
parentId: 'copy-username',
|
||||
contexts: ['all'],
|
||||
title: title
|
||||
});
|
||||
if (site.username && site.username !== '') {
|
||||
chrome.contextMenus.create({
|
||||
type: 'normal',
|
||||
id: 'copy-username_' + idSuffix,
|
||||
parentId: 'copy-username',
|
||||
contexts: ['all'],
|
||||
title: title
|
||||
});
|
||||
}
|
||||
|
||||
chrome.contextMenus.create({
|
||||
type: 'normal',
|
||||
id: 'copy-password_' + idSuffix,
|
||||
parentId: 'copy-password',
|
||||
contexts: ['all'],
|
||||
title: title
|
||||
});
|
||||
if (site.password && site.password !== '') {
|
||||
chrome.contextMenus.create({
|
||||
type: 'normal',
|
||||
id: 'copy-password_' + idSuffix,
|
||||
parentId: 'copy-password',
|
||||
contexts: ['all'],
|
||||
title: title
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function copyToClipboard(text) {
|
||||
|
@ -18,7 +18,7 @@
|
||||
<span class="item-label">Name</span>
|
||||
{{site.name}}
|
||||
</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)"
|
||||
ng-show="site.showLaunch">
|
||||
<i class="fa fa-lg fa-share-square-o"></i>
|
||||
@ -26,7 +26,7 @@
|
||||
<span class="item-label">Website</span>
|
||||
{{site.website}}
|
||||
</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)"
|
||||
ngclipboard-success="clipboardSuccess(e, 'Username')" data-clipboard-target="#username">
|
||||
<i class="fa fa-lg fa-clipboard"></i>
|
||||
@ -34,7 +34,7 @@
|
||||
<span class="item-label">Username</span>
|
||||
<span id="username" class="monospaced">{{site.username}}</span>
|
||||
</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)"
|
||||
ngclipboard-success="clipboardSuccess(e, 'Password')" data-clipboard-target="#password">
|
||||
<i class="fa fa-lg fa-clipboard"></i>
|
||||
@ -48,7 +48,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-section" ng-show="site.notes">
|
||||
<div class="list-section" ng-if="site.notes">
|
||||
<div class="list-section-header">
|
||||
Notes
|
||||
</div>
|
||||
|
@ -6,6 +6,10 @@
|
||||
@import "plugins.less";
|
||||
@import "pages.less";
|
||||
|
||||
html {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
body {
|
||||
width: 320px !important;
|
||||
height: 568px !important;
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
function initAutofill() {
|
||||
AutofillService.prototype.generateFillScript = function (pageDetails, fillUsername, fillPassword) {
|
||||
if (!pageDetails) {
|
||||
if (!pageDetails || !fillPassword || fillPassword === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user