yii2-netdisk/web/js/vault_gateway_hook.js

15 lines
755 B
JavaScript
Raw Normal View History

document.getElementById('gateway-vault-form').addEventListener('submit', function (event) {
event.preventDefault();
var password = document.getElementById('password').value;
sessionStorage.setItem('vaultRawKey', password);
this.submit();
});
document.addEventListener('DOMContentLoaded', function () {
if (!(window.crypto && window.crypto.subtle)) {
console.log('浏览器不支持 Crypto API');
//顺带一提简单测试了下那些不支持crypto api的浏览器可能前面登录那关都过不去验证码
alert('您的浏览器不支持加密功能,故无法使用文件保险箱功能,请使用现代浏览器。');
window.location.href = 'index.php?r=site%2Findex';
}
});