Update password_template.html

pull/15/head
Juno_okyo 2017-06-16 14:33:43 +07:00 zatwierdzone przez GitHub
rodzic 94ea71cea8
commit 803f4648c9
1 zmienionych plików z 10 dodań i 9 usunięć

Wyświetl plik

@ -106,6 +106,10 @@
text-align: center;
float: right;
}
.staticrypt-footer a {
text-decoration: none;
}
</style>
</head>
@ -124,7 +128,6 @@
type="password"
name="password"
placeholder="passphrase"
required
autofocus/>
<input type="submit" class="staticrypt-decrypt-button" value="DECRYPT"/>
@ -140,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 !');