diff --git a/css/popup.css b/css/popup.css index d317e0c..440ad01 100644 --- a/css/popup.css +++ b/css/popup.css @@ -303,7 +303,8 @@ body { opacity: 1; } -#codes.edit .showqr { +#codes.edit .showqr, +.showqr.hidden { display: none; } @@ -595,7 +596,7 @@ body { } #exportData { - height: 340px; + height: 330px; width: 100%; word-break: break-all; resize: none; diff --git a/javascript/popup.js b/javascript/popup.js index 0dd9b52..3a62cfc 100644 --- a/javascript/popup.js +++ b/javascript/popup.js @@ -137,6 +137,24 @@ document.getElementById('security_save').onclick = function () { } } +document.getElementById('phrase').onkeydown = function(e) { + if (e.keyCode === 13) { + var phrase = document.getElementById('phrase').value; + document.getElementById('phrase').value = ''; + localStorage.notRememberPassphrase = (!document.getElementById('remeber_phrase').checked).toString(); + document.getElementById('remeber_new_phrase').checked = document.getElementById('remeber_phrase').checked; + encryptSecret(phrase, false, function () { + document.getElementById('passphrase').className = 'fadeout'; + setTimeout(function () { + document.getElementById('passphrase').className = ''; + document.getElementById('passphrase').style.opacity = 0; + }, 200); + }, function () { + showMessage(chrome.i18n.getMessage('phrase_incorrect')); + }); + } +} + document.getElementById('passphrase_ok').onclick = function () { var phrase = document.getElementById('phrase').value; document.getElementById('phrase').value = ''; @@ -515,6 +533,7 @@ function updateCode() { for (var i = 0; i < _secret.length; i++) { if (!_secret[i].secret) { document.getElementById('code-' + i).innerText = chrome.i18n.getMessage('encrypted'); + document.getElementById('showqr-' + i).className = 'showqr hidden'; if (!shownPassphrase) { shownPassphrase = true; document.getElementById('passphrase').className = 'fadein'; @@ -524,6 +543,7 @@ function updateCode() { } } else if (_secret[i].type !== 'hotp') { document.getElementById('code-' + i).innerText = getCode(_secret[i].secret); + document.getElementById('showqr-' + i).className = 'showqr'; } } } diff --git a/manifest.json b/manifest.json index 0399a86..6015892 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "__MSG_extName__", "short_name": "__MSG_extShortName__", - "version": "4.15", + "version": "4.16", "default_locale": "en", "description": "__MSG_extDesc__", "icons": { diff --git a/totp/totp.js b/totp/totp.js index 75da67f..346445e 100644 --- a/totp/totp.js +++ b/totp/totp.js @@ -25,6 +25,10 @@ var KeyUtilities = function() { hex = hex + parseInt(chunk, 2).toString(16); } + if (hex.length % 2 && hex[hex.length - 1] === '0') { + hex = hex.substr(0, hex.length - 1); + } + return hex; };