Skip to content

Commit 0f70d7d

Browse files
committed
Add never save option to password dialog
minbrowser#1549
1 parent 8d4272f commit 0f70d7d

29 files changed

+117
-1
lines changed

css/passwordCapture.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,22 @@
5151
background: rgba(255, 255, 255, 0.15);
5252
}
5353

54+
#password-capture-never-save {
55+
padding: 0.33em 1em;
56+
font-size: 14px;
57+
position: absolute;
58+
right: 0.75em;
59+
top: 50%;
60+
transform: translateY(-50%);
61+
height: 2em;
62+
}
63+
64+
@media all and (max-width: 1065px) {
65+
#password-capture-never-save {
66+
display: none
67+
}
68+
}
69+
5470
#password-capture-username {
5571
margin-right: 0.5em;
5672
}

css/passwordViewer.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@
2727
min-width: 0;
2828
}
2929

30+
#password-viewer-list > div > span.description {
31+
flex: 1;
32+
opacity: 0.9;
33+
font-style: italic;
34+
}
35+
3036
#password-viewer .domain-name {
3137
width: 30%;
3238
overflow: hidden;

index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,10 @@ <h3 class="modal-title" id="manager-setup-heading"></h3>
302302
data-string="passwordCaptureDontSave"
303303
></button>
304304
</span>
305+
<button
306+
id="password-capture-never-save"
307+
data-string="passwordCaptureNeverSave"
308+
></button>
305309
</div>
306310

307311
<div id="password-viewer" class="modal" hidden>

js/passwordManager/passwordCapture.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const webviews = require('webviews.js')
2+
const settings = require('util/settings/settings.js')
23
const PasswordManagers = require('passwordManager/passwordManager.js')
34

45
const passwordCapture = {
@@ -8,6 +9,7 @@ const passwordCapture = {
89
passwordInput: document.getElementById('password-capture-password'),
910
revealButton: document.getElementById('password-capture-reveal-password'),
1011
saveButton: document.getElementById('password-capture-save'),
12+
neverSaveButton: document.getElementById('password-capture-never-save'),
1113
closeButton: document.getElementById('password-capture-ignore'),
1214
currentDomain: null,
1315
barHeight: 0,
@@ -50,6 +52,10 @@ const passwordCapture = {
5052
domain = domain.slice(4)
5153
}
5254

55+
if (settings.get('passwordsNeverSaveDomains') && settings.get('passwordsNeverSaveDomains').includes(domain)) {
56+
return
57+
}
58+
5359
var username = args[0][1] || ''
5460
var password = args[0][2] || ''
5561

@@ -89,6 +95,11 @@ const passwordCapture = {
8995
}
9096
})
9197

98+
passwordCapture.neverSaveButton.addEventListener('click', function () {
99+
settings.set('passwordsNeverSaveDomains', (settings.get('passwordsNeverSaveDomains') || []).concat([passwordCapture.currentDomain]))
100+
passwordCapture.hideCaptureBar()
101+
})
102+
92103
passwordCapture.closeButton.addEventListener('click', passwordCapture.hideCaptureBar)
93104
passwordCapture.revealButton.addEventListener('click', passwordCapture.togglePasswordVisibility)
94105

js/passwordManager/passwordViewer.js

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const webviews = require('webviews.js')
2+
const settings = require('util/settings/settings.js')
23
const PasswordManagers = require('passwordManager/passwordManager.js')
34
const modalMode = require('modalMode.js')
45

@@ -56,6 +57,30 @@ const passwordViewer = {
5657

5758
return container
5859
},
60+
createNeverSaveDomainElement: function (domain) {
61+
var container = document.createElement('div')
62+
63+
var domainEl = document.createElement('span')
64+
domainEl.className = 'domain-name'
65+
domainEl.textContent = domain
66+
container.appendChild(domainEl)
67+
68+
var descriptionEl = document.createElement('span')
69+
descriptionEl.className = 'description'
70+
descriptionEl.textContent = l('savedPasswordsNeverSavedLabel')
71+
container.appendChild(descriptionEl)
72+
73+
var deleteButton = document.createElement('button')
74+
deleteButton.className = 'i carbon:trash-can'
75+
container.appendChild(deleteButton)
76+
77+
deleteButton.addEventListener('click', function () {
78+
settings.set('passwordsNeverSaveDomains', settings.get('passwordsNeverSaveDomains').filter(d => d !== domain))
79+
container.remove()
80+
})
81+
82+
return container
83+
},
5984
show: function () {
6085
PasswordManagers.getConfiguredPasswordManager().then(function (manager) {
6186
if (!manager.getAllCredentials) {
@@ -73,7 +98,13 @@ const passwordViewer = {
7398
passwordViewer.listContainer.appendChild(passwordViewer.createCredentialListElement(cred))
7499
})
75100

76-
passwordViewer.emptyHeading.hidden = (credentials.length !== 0)
101+
const neverSaveDomains = settings.get('passwordsNeverSaveDomains') || []
102+
103+
neverSaveDomains.forEach(function (domain) {
104+
passwordViewer.listContainer.appendChild(passwordViewer.createNeverSaveDomainElement(domain))
105+
})
106+
107+
passwordViewer.emptyHeading.hidden = (credentials.length + neverSaveDomains.length !== 0)
77108
})
78109
})
79110
},

localization/languages/ar.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,11 @@
261261
"passwordCaptureSavePassword": null, //missing translation
262262
"passwordCaptureSave": null, //missing translation
263263
"passwordCaptureDontSave": null, //missing translation
264+
"passwordCaptureNeverSave": null, //missing translation
264265
/* Password viewer */
265266
"savedPasswordsHeading": null, //missing translation
266267
"savedPasswordsEmpty": null, //missing translation
268+
"savedPasswordsNeverSavedLabel": null, //missing translation
267269
"deletePassword": null, //missing translation
268270
/* Dialogs */
269271
"loginPromptTitle": null, //missing translation

localization/languages/bg.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,11 @@
264264
"passwordCaptureSavePassword": "Запази парола за %s?",
265265
"passwordCaptureSave": "Запази",
266266
"passwordCaptureDontSave": "Не запазвай",
267+
"passwordCaptureNeverSave": null, //missing translation
267268
/* Password viewer */
268269
"savedPasswordsHeading": "Запазени пароли",
269270
"savedPasswordsEmpty": "Няма запазени пароли.",
271+
"savedPasswordsNeverSavedLabel": null, //missing translation
270272
"deletePassword": "Изтрий парола за %s?",
271273
/* Dialogs */
272274
"loginPromptTitle": "Впишете се в %h (%r)", //%h is replaced with host, %r with realm (title of protected part of site)

localization/languages/bn.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,11 @@
261261
"passwordCaptureSavePassword": null, //missing translation
262262
"passwordCaptureSave": null, //missing translation
263263
"passwordCaptureDontSave": null, //missing translation
264+
"passwordCaptureNeverSave": null, //missing translation
264265
/* Password viewer */
265266
"savedPasswordsHeading": null, //missing translation
266267
"savedPasswordsEmpty": null, //missing translation
268+
"savedPasswordsNeverSavedLabel": null, //missing translation
267269
"deletePassword": null, //missing translation
268270
/* Dialogs */
269271
"loginPromptTitle": null, //missing translation

localization/languages/cs.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,11 @@
265265
"passwordCaptureSavePassword": "Uložit heslo pro %s?",
266266
"passwordCaptureSave": "Uložit",
267267
"passwordCaptureDontSave": "Neukládat",
268+
"passwordCaptureNeverSave": null, //missing translation
268269
/* Password viewer */
269270
"savedPasswordsHeading": "Uložená hesla",
270271
"savedPasswordsEmpty": "Žádná uložená hesla",
272+
"savedPasswordsNeverSavedLabel": null, //missing translation
271273
"deletePassword": "Odstranit heslo pro %s?",
272274
/* Dialogs */
273275
"loginPromptTitle": "Přihlášení do %h (%r)", //%h is replaced with host, %r with realm (title of protected part of site)

localization/languages/de.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,11 @@
267267
"passwordCaptureSavePassword": "Zugangsdaten für %s speichern?",
268268
"passwordCaptureSave": "Speichern",
269269
"passwordCaptureDontSave": "Nicht speichern",
270+
"passwordCaptureNeverSave": null, //missing translation
270271
/* Password viewer */
271272
"savedPasswordsHeading": "Gespeicherte Passwörter",
272273
"savedPasswordsEmpty": "Keine gespeicherte Passwörter",
274+
"savedPasswordsNeverSavedLabel": null, //missing translation
273275
"deletePassword": "Zugangsdaten für %s löschen?",
274276
/* Dialogs */
275277
"loginPromptTitle": "Bei %h (%r) anmelden", //%h is replaced with host, %r with realm (title of protected part of site)

0 commit comments

Comments
 (0)