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