1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #1049: Prompt user if missing session key when adding/editing a secret

This commit is contained in:
Jeremy Stretch
2017-04-06 13:55:40 -04:00
parent ee11775425
commit 82d53a8c3d
3 changed files with 36 additions and 9 deletions

View File

@@ -1,15 +1,25 @@
$(document).ready(function() {
// Unlocking a secret
$('button.unlock-secret').click(function() {
$('button.unlock-secret').click(function(event) {
var secret_id = $(this).attr('secret-id');
unlock_secret(secret_id);
event.preventDefault();
});
// Locking a secret
$('button.lock-secret').click(function() {
$('button.lock-secret').click(function(event) {
var secret_id = $(this).attr('secret-id');
lock_secret(secret_id);
event.preventDefault();
});
// Adding/editing a secret
$('form.requires-session-key').submit(function(event) {
if ($('#id_plaintext').val() && document.cookie.indexOf('session_key') == -1) {
$('#privkey_modal').modal('show');
event.preventDefault();
}
});
// Retrieve a session key