debian-mirror-gitlab/app/assets/javascripts/pages/profiles/keys/index.js
2022-03-02 08:16:31 +05:30

25 lines
827 B
JavaScript

import initConfirmModal from '~/confirm_modal';
import AddSshKeyValidation from '~/profile/add_ssh_key_validation';
initConfirmModal();
function initSshKeyValidation() {
const input = document.querySelector('.js-add-ssh-key-validation-input');
if (!input) return;
const supportedAlgorithms = JSON.parse(input.dataset.supportedAlgorithms);
const warning = document.querySelector('.js-add-ssh-key-validation-warning');
const originalSubmit = input.form.querySelector('.js-add-ssh-key-validation-original-submit');
const confirmSubmit = warning.querySelector('.js-add-ssh-key-validation-confirm-submit');
const addSshKeyValidation = new AddSshKeyValidation(
supportedAlgorithms,
input,
warning,
originalSubmit,
confirmSubmit,
);
addSshKeyValidation.register();
}
initSshKeyValidation();