Merge pull request #15 from J2TeaM/dev

Minor improvements
pull/18/head
Robin Moisson 2017-06-16 10:57:43 +02:00 zatwierdzone przez GitHub
commit bedc7c2347
1 zmienionych plików z 14 dodań i 10 usunięć

Wyświetl plik

@ -58,6 +58,7 @@
padding: 15px;
color: #FFFFFF;
font-size: 14px;
cursor: pointer;
}
.staticrypt-form .staticrypt-decrypt-button:hover, .staticrypt-form .staticrypt-decrypt-button:active, .staticrypt-form .staticrypt-decrypt-button:focus {
@ -105,6 +106,10 @@
text-align: center;
float: right;
}
.staticrypt-footer a {
text-decoration: none;
}
</style>
</head>
@ -122,7 +127,8 @@
<input id="staticrypt-password"
type="password"
name="password"
placeholder="passphrase"/>
placeholder="passphrase"
autofocus/>
<input type="submit" class="staticrypt-decrypt-button" value="DECRYPT"/>
</form>
@ -137,16 +143,14 @@
{crypto_tag}
<script>
document.getElementById('staticrypt-form').addEventListener('submit', function (e) {
document.getElementById('staticrypt-form').addEventListener('submit', function(e) {
e.preventDefault();
var passphrase = document.getElementById('staticrypt-password').value
var encryptedMsg = '{encrypted}';
var encryptedHMAC = encryptedMsg.substring(0, 64);
var encryptedHTML = encryptedMsg.substring(64);
var decryptedHMAC = CryptoJS.HmacSHA256(encryptedHTML, CryptoJS.SHA256(passphrase)).toString();
var passphrase = document.getElementById('staticrypt-password').value,
encryptedMsg = '{encrypted}',
encryptedHMAC = encryptedMsg.substring(0, 64),
encryptedHTML = encryptedMsg.substring(64),
decryptedHMAC = CryptoJS.HmacSHA256(encryptedHTML, CryptoJS.SHA256(passphrase)).toString();
if (decryptedHMAC !== encryptedHMAC) {
alert('Bad passphrase !');
@ -160,4 +164,4 @@
});
</script>
</body>
</html>
</html>