diff options
author | Marvin Borner | 2018-07-14 22:46:02 +0200 |
---|---|---|
committer | Marvin Borner | 2018-07-14 22:46:02 +0200 |
commit | 693ea52ab9e080d415d80c19c4d53ddd21d6fcc6 (patch) | |
tree | 92636715d2a54bc548a2eedd12a27c92c59f1ff4 /public/3fc17c73a369921b5d2a49b8e752592b.js | |
parent | d2d48574de2a18513f9a310d979406faaa41ee94 (diff) |
Rewritten admin interface webpack generation (had bugs before)
Diffstat (limited to 'public/3fc17c73a369921b5d2a49b8e752592b.js')
-rw-r--r-- | public/3fc17c73a369921b5d2a49b8e752592b.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/public/3fc17c73a369921b5d2a49b8e752592b.js b/public/3fc17c73a369921b5d2a49b8e752592b.js new file mode 100644 index 0000000..1b6875f --- /dev/null +++ b/public/3fc17c73a369921b5d2a49b8e752592b.js @@ -0,0 +1,30 @@ +$('form[keygen]').submit((event) => { + event.preventDefault(); + + $('button[type="submit"]').attr("disabled", true).html('Loading...'); + + var openpgp = window.openpgp; + + var options = { + userIds: [{ + email: $("input#email").val() + }], + numBits: 4096, + passphrase: $("input#password").val() + }; + + openpgp.generateKey(options).then((key) => { + var privateKey = key.privateKeyArmored; + var publicKey = key.publicKeyArmored; + + localStorage.setItem("privkey", privateKey); + + var now = new Date(); + var time = now.getTime(); + time += 3600 * 1000; + now.setTime(time); + document.cookie = "publickey=" + encodeURI(publicKey.substr(96).slice(0, -35)) + "; expires=" + now.toUTCString() + ";"; + + $('form[keygen]').unbind('submit').submit(); + }); +});
\ No newline at end of file |