mirror of
https://github.com/Brandon-Rozek/website-theme.git
synced 2024-11-26 18:13:59 -05:00
Minor updates to pgp form
This commit is contained in:
parent
064884cccb
commit
fff2a4ecb6
1 changed files with 5 additions and 4 deletions
|
@ -9,7 +9,8 @@ Encrypted Result:
|
||||||
function encrypt() {
|
function encrypt() {
|
||||||
let textarea = document.querySelector("#pgpcleartext");
|
let textarea = document.querySelector("#pgpcleartext");
|
||||||
let resultarea = document.querySelector('#pgpresult');
|
let resultarea = document.querySelector('#pgpresult');
|
||||||
let pubKeyURL = "{{ .Get 0 }}"
|
let pubKeyURL = "{{ .Get 0 }}";
|
||||||
|
resultarea.textContent = "";
|
||||||
fetch(pubKeyURL).then(function(response) {
|
fetch(pubKeyURL).then(function(response) {
|
||||||
return response.text().then(function(text) {
|
return response.text().then(function(text) {
|
||||||
const pubKey = openpgp.readKey({ armoredKey: text });
|
const pubKey = openpgp.readKey({ armoredKey: text });
|
||||||
|
@ -18,9 +19,9 @@ function encrypt() {
|
||||||
const encryptionParameters = {
|
const encryptionParameters = {
|
||||||
message: mp[0],
|
message: mp[0],
|
||||||
encryptionKeys: mp[1]
|
encryptionKeys: mp[1]
|
||||||
}
|
};
|
||||||
return openpgp.encrypt(encryptionParameters).then(function(encryptedMessage) {
|
return openpgp.encrypt(encryptionParameters).then(function(encryptedMessage) {
|
||||||
pgpresult.textContent = encryptedMessage
|
resultarea.textContent = encryptedMessage;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -31,7 +32,7 @@ function genEmail() {
|
||||||
let resultarea = document.querySelector('#pgpresult');
|
let resultarea = document.querySelector('#pgpresult');
|
||||||
let contents = resultarea.textContent;
|
let contents = resultarea.textContent;
|
||||||
let encodedContents = encodeURIComponent(contents);
|
let encodedContents = encodeURIComponent(contents);
|
||||||
let encodedSubject = encodeURIComponent("Contact Form")
|
let encodedSubject = encodeURIComponent("Contact Form");
|
||||||
window.location.href = "mailto:{{ .Site.Params.email }}?subject=" +
|
window.location.href = "mailto:{{ .Site.Params.email }}?subject=" +
|
||||||
encodedSubject + "&body=" + encodedContents;
|
encodedSubject + "&body=" + encodedContents;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue