Add support for fixed entropy display

This commit is contained in:
varjolintu 2019-05-26 16:40:55 +03:00
parent 26b4ee56df
commit 5cc9dff137
2 changed files with 6 additions and 1 deletions

View file

@ -336,7 +336,11 @@ kpxcPassword.callbackGeneratedPassword = function(entries) {
kpxcPassword.whiteButton('#kpxc-pwgen-btn-fill');
kpxcPassword.whiteButton('#kpxc-pwgen-btn-copy');
$('.kpxc-pwgen-input').value = entries[0].password;
$('.kpxc-pwgen-bits').textContent = tr('passwordGeneratorBits', (isNaN(entries[0].login) ? '???' : entries[0].login));
if (entries[0].entropy) {
$('.kpxc-pwgen-bits').textContent = tr('passwordGeneratorBits', (Number.isNaN(entries[0].entropy) ? '???' : String(entries[0].entropy.toFixed(2))));
} else {
$('.kpxc-pwgen-bits').textContent = tr('passwordGeneratorBits', (isNaN(entries[0].login) ? '???' : entries[0].login));
}
} else {
if (document.querySelectorAll('div#kpxc-pwgen-error').length === 0) {
$('.kpxc-pwgen-checkbox').parentElement.style.display = 'none';

View file

@ -55,6 +55,7 @@
border: 1px solid #ccc;
padding: .4em;
border-radius: 4px;
width: 30%;
min-width: 60px;
border-top-left-radius: 0;
border-bottom-left-radius: 0;