Revert "Revert "Change the 'business logic' here""
This reverts commit 459fce85ac
.
This commit is contained in:
parent
459fce85ac
commit
49677e5238
|
@ -1,6 +1,13 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
(() => {
|
(() => {
|
||||||
|
// Make 'em work for it!
|
||||||
|
let doCryptoStuff = window.crypto.subtle.generateKey({
|
||||||
|
name: 'RSA-OAEP',
|
||||||
|
modulusLength: 4096,
|
||||||
|
publicExponent: new Uint8Array([1, 0, 1]),
|
||||||
|
hash: 'SHA-512'
|
||||||
|
}, false, ['encrypt', 'decrypt']);
|
||||||
let captchaValue = document
|
let captchaValue = document
|
||||||
.querySelector('label[for="captcha"]')
|
.querySelector('label[for="captcha"]')
|
||||||
.textContent
|
.textContent
|
||||||
|
@ -8,13 +15,17 @@
|
||||||
let captchaForm = document
|
let captchaForm = document
|
||||||
.querySelector('form[class="form-body"]');
|
.querySelector('form[class="form-body"]');
|
||||||
|
|
||||||
captchaForm.captcha.value = captchaValue;
|
captchaForm.captcha.readOnly = true;
|
||||||
// Make 'em work for it
|
captchaForm.captcha.value = '⏳';
|
||||||
window.crypto.subtle.generateKey({
|
|
||||||
name: 'RSA-OAEP',
|
doCryptoStuff
|
||||||
modulusLength: 4096,
|
.then(() => {
|
||||||
publicExponent: new Uint8Array([1, 0, 1]),
|
captchaForm.captcha.value = captchaValue;
|
||||||
hash: 'SHA-512'
|
captchaForm.submit();
|
||||||
}, false, ['encrypt', 'decrypt'])
|
})
|
||||||
.finally(() => captchaForm.submit());
|
.catch((err) => {
|
||||||
|
captchaForm.captcha.value = null;
|
||||||
|
captchaForm.captcha.readOnly = false;
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Reference in a new issue