1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 15:23:33 +00:00

detect and update password changes

This commit is contained in:
Kyle Spearrin
2018-07-31 23:24:11 -04:00
parent 272f6cfde6
commit cf57eadd1d
9 changed files with 248 additions and 110 deletions

View File

@@ -34,6 +34,16 @@
</tr>
</tbody>
</table>
<table class="inner-table" cellpadding="0" cellspacing="0" id="template-change">
<tbody>
<tr>
<td class="change-text"></td>
<td align="right" class="change-buttons">
<button class="change-save"></button>
</td>
</tr>
</tbody>
</table>
<div id="template-alert"></div>
</div>
</body>

View File

@@ -23,6 +23,8 @@ document.addEventListener('DOMContentLoaded', () => {
i18n.notificationAddSave = chrome.i18n.getMessage('notificationAddSave');
i18n.notificationNeverSave = chrome.i18n.getMessage('notificationNeverSave');
i18n.notificationAddDesc = chrome.i18n.getMessage('notificationAddDesc');
i18n.notificationChangeSave = chrome.i18n.getMessage('notificationChangeSave');
i18n.notificationChangeDesc = chrome.i18n.getMessage('notificationChangeDesc');
// delay 50ms so that we get proper body dimensions
setTimeout(load, 50);
@@ -42,12 +44,15 @@ document.addEventListener('DOMContentLoaded', () => {
if (bodyRect.width < 768) {
document.querySelector('#template-add .add-save').textContent = i18n.yes;
document.querySelector('#template-add .never-save').textContent = i18n.never;
document.querySelector('#template-change .change-save').textContent = i18n.yes;
} else {
document.querySelector('#template-add .add-save').textContent = i18n.notificationAddSave;
document.querySelector('#template-add .never-save').textContent = i18n.notificationNeverSave;
document.querySelector('#template-change .change-save').textContent = i18n.notificationChangeSave;
}
document.querySelector('#template-add .add-text').textContent = i18n.notificationAddDesc;
document.querySelector('#template-change .change-text').textContent = i18n.notificationChangeDesc;
if (getQueryVariable('add')) {
setContent(document.getElementById('template-add'));
@@ -68,6 +73,15 @@ document.addEventListener('DOMContentLoaded', () => {
command: 'bgNeverSave'
});
});
} else if (getQueryVariable('change')) {
setContent(document.getElementById('template-change'));
var changeButton = document.querySelector('#template-change-clone .change-save');
changeButton.addEventListener('click', (e) => {
e.preventDefault();
sendPlatformMessage({
command: 'bgChangeSave'
});
});
} else if (getQueryVariable('info')) {
setContent(document.getElementById('template-alert'));
document.getElementById('template-alert-clone').textContent = getQueryVariable('info');