settings: pasting private key should update pubkey
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/pr/woodpecker Pipeline was successful Details

If the user pastes a private-key and the pubkey input is empty,
it should be ok to generate and autofill the pubkey field without
confusing the user. There might be circumstances where it is
preferred to see an error if the pubkey does not correspond with
the private key.

Added an on paste event listener that tries to generate and auto-
fill the pubkey (if empty).
OFF0 2 years ago
parent cfb7a2dc35
commit 8ab09fda40
Signed by: offbyn
GPG Key ID: 94A2F643C51F37FA

@ -579,6 +579,13 @@ importBtn.addEventListener('click', () => {
}); });
settingsForm.addEventListener('input', () => validKeys(privateKeyInput.value, pubKeyInput.value)); settingsForm.addEventListener('input', () => validKeys(privateKeyInput.value, pubKeyInput.value));
privateKeyInput.addEventListener('paste', (event) => {
if (!pubKeyInput.value && event.clipboardData) {
try {
pubKeyInput.value = getPublicKey(event.clipboardData.getData('text'));
} catch(err) {} // ignore as the error will be shown by validKeys later on input
}
});
function validKeys(privatekey, pubkey) { function validKeys(privatekey, pubkey) {
try { try {

Loading…
Cancel
Save