mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-09-12 22:07:17 +00:00
- Add javascript to clear fields upon clicking the cancel button inside the panel for adding new SSH keys. - Add E2E test. - Resolves #8915 Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8990 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: dawe <dawedawe@posteo.de> Co-committed-by: dawe <dawedawe@posteo.de>
17 lines
610 B
JavaScript
17 lines
610 B
JavaScript
export function initSshKeyFormParser() {
|
|
// Parse SSH Key
|
|
document.getElementById('ssh-key-content')?.addEventListener('input', function () {
|
|
const arrays = this.value.split(' ');
|
|
const title = document.getElementById('ssh-key-title');
|
|
if (!title.value && arrays.length === 3 && arrays[2] !== '') {
|
|
title.value = arrays[2];
|
|
}
|
|
});
|
|
}
|
|
|
|
export function initSshKeyCancelButton() {
|
|
document.getElementById('cancel-ssh-button')?.addEventListener('click', () => {
|
|
document.getElementById('ssh-key-title').value = '';
|
|
document.getElementById('ssh-key-content').value = '';
|
|
});
|
|
}
|