mirror of https://github.com/JohnHammond/CTFd.git
Fixing key updating
parent
4795a9e742
commit
ad34dbf970
|
@ -45,7 +45,6 @@ def admin_keys_view(keyid):
|
||||||
db.session.add(k)
|
db.session.add(k)
|
||||||
else:
|
else:
|
||||||
k = Keys.query.filter_by(id=keyid).first()
|
k = Keys.query.filter_by(id=keyid).first()
|
||||||
k.chal = chal
|
|
||||||
k.flag = flag
|
k.flag = flag
|
||||||
k.data = data
|
k.data = data
|
||||||
k.key_type = key_type
|
k.key_type = key_type
|
||||||
|
|
|
@ -174,10 +174,6 @@
|
||||||
<input name='nonce' type='hidden' value="{{ nonce }}">
|
<input name='nonce' type='hidden' value="{{ nonce }}">
|
||||||
<input id="keys-chal" name='chal' type='hidden'>
|
<input id="keys-chal" name='chal' type='hidden'>
|
||||||
<div id="current-keys" class="row"></div>
|
<div id="current-keys" class="row"></div>
|
||||||
<div class="row">
|
|
||||||
<input type="hidden" value="{{ nonce }}" name="nonce" id="nonce">
|
|
||||||
<button id="submit-keys" class="btn btn-theme btn-outlined">Update</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -207,152 +203,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div id="update-tags" class="modal fade" tabindex="-1">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header text-center">
|
|
||||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
||||||
<h3>Tags</h3>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="tag-insert">Value</label>
|
|
||||||
<input max-length="80" type="text" class="form-control tag-insert" name="tag-insert" placeholder="Type tag and press Enter">
|
|
||||||
</div>
|
|
||||||
<input name='nonce' type='hidden' value="{{ nonce }}">
|
|
||||||
<input id="tags-chal" name='chal' type='hidden'>
|
|
||||||
|
|
||||||
<div id="current-tags">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<br/>
|
|
||||||
<div id="chal-tags">
|
|
||||||
</div>
|
|
||||||
<div class="row" style="text-align:center;margin-top:20px">
|
|
||||||
<input type="hidden" value="{{ nonce }}" name="nonce" id="nonce">
|
|
||||||
<button class="btn btn-theme btn-outlined" id="submit-tags">Update</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="update-files" class="modal fade" tabindex="-1">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header text-center">
|
|
||||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
||||||
<h3>Files</h3>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<form method="POST" action="{{ request.script_root }}/admin/files/" enctype="multipart/form-data">
|
|
||||||
<input name='nonce' type='hidden' value="{{ nonce }}">
|
|
||||||
<input id="files-chal" name='chal' type='hidden'>
|
|
||||||
<input name='method' type='hidden' value='upload'>
|
|
||||||
|
|
||||||
<div id="current-files"></div>
|
|
||||||
<input type="hidden" name="method" value="upload">
|
|
||||||
<input type="file" name="files[]" multiple="multiple">
|
|
||||||
<sub class="help-block">Attach ultiple files using Control+Click or Cmd+Click.</sub>
|
|
||||||
<div class="row" style="text-align:center;margin-top:20px">
|
|
||||||
<input type="hidden" value="{{ nonce }}" name="nonce" id="nonce">
|
|
||||||
<button class="btn btn-theme btn-outlined" id="submit-files">Update</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="update-hints" class="modal fade" tabindex="-1">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header text-center">
|
|
||||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
||||||
<h3>Hints</h3>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<div class="row" style="text-align:center">
|
|
||||||
<a href="#" id="create-hint" class="btn btn-primary" style="margin-bottom:15px;">New Hint</a>
|
|
||||||
</div>
|
|
||||||
<div class='current-hints'>
|
|
||||||
<table id="hintsboard" class="table table-striped">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<td class="text-center"><b>Hint</b></td>
|
|
||||||
<td class="text-center"><b>Cost</b></td>
|
|
||||||
<td class="text-center"><b>Settings</b></td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody class="text-center">
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="update-keys" class="modal fade" tabindex="-1">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header text-center">
|
|
||||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
||||||
<h3>Keys</h3>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<form method="POST" action="{{ request.script_root }}/admin/keys" style="text-align:center">
|
|
||||||
<a href="#" id="create-key" class="btn btn-primary" style="margin-bottom:15px;">New Key</a>
|
|
||||||
<input name='nonce' type='hidden' value="{{ nonce }}">
|
|
||||||
<input id="keys-chal" name='chal' type='hidden'>
|
|
||||||
<div id="current-keys" class="row"></div>
|
|
||||||
<div class="row">
|
|
||||||
<input type="hidden" value="{{ nonce }}" name="nonce" id="nonce">
|
|
||||||
<button id="submit-keys" class="btn btn-theme btn-outlined">Update</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="delete-chal" class="modal fade" tabindex="-1">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header text-center">
|
|
||||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
||||||
<h3>Delete Challenge</h3>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<form method="POST" action="{{ request.script_root }}/admin/chal/delete">
|
|
||||||
<input type="hidden" name="nonce" value="{{ nonce }}">
|
|
||||||
<input type="hidden" name="id" class="chal-id">
|
|
||||||
<div class="small-6 small-centered text-center columns">
|
|
||||||
<p>Are you sure you want to delete this challenge?</p>
|
|
||||||
<p>Solves, wrong keys, files, tags will all be deleted.</p>
|
|
||||||
<a onclick="$('#delete-chal').modal('hide')" class="btn btn-primary">No</a>
|
|
||||||
<button class="btn btn-danger" id="delete-user" type="submit">Delete</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="update-challenge" class="modal fade" tabindex="-1">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
||||||
<h3 class="chal-title text-center"></h3>
|
|
||||||
</div>
|
|
||||||
<div id="update-chal-entry-div" class="modal-body">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="create-keys" class="modal fade" tabindex="-1">
|
<div id="create-keys" class="modal fade" tabindex="-1">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
|
|
|
@ -105,7 +105,7 @@ function updatekey(){
|
||||||
loadkeys(chal);
|
loadkeys(chal);
|
||||||
$('#edit-keys').modal('toggle');
|
$('#edit-keys').modal('toggle');
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadtags(chal){
|
function loadtags(chal){
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<form method="POST" action="{{ script_root }}/admin/keys/{{id}}" style="text-align:center">
|
<form method="POST" action="{{ script_root }}/admin/keys/{{id}}" style="text-align:center">
|
||||||
<input type="text" id="key-data" class="form-control" name="key" value="{{key}}" placeholder="Enter regex key data">
|
<input type="text" id="key-data" class="form-control" name="key" value="{{key}}" placeholder="Enter regex key data">
|
||||||
<input type="hidden" id="key-type" value="1">
|
<input type="hidden" id="key-type" name="key_type" value="1">
|
||||||
<input type="hidden" id="key-id">
|
<input type="hidden" id="key-id">
|
||||||
<hr>
|
<hr>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<form method="POST" action="{{ script_root }}/admin/keys/{{id}}" style="text-align:center">
|
<form method="POST" action="{{ script_root }}/admin/keys/{{id}}" style="text-align:center">
|
||||||
<input type="text" id="key-data" class="form-control" name="key" value="{{key}}" placeholder="Enter static key data">
|
<input type="text" id="key-data" class="form-control" name="key" value="{{key}}" placeholder="Enter static key data">
|
||||||
<input type="hidden" id="key-type" value="0">
|
<input type="hidden" id="key-type" name="key_type" value="0">
|
||||||
<input type="hidden" id="key-id">
|
<input type="hidden" id="key-id">
|
||||||
<hr>
|
<hr>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
Loading…
Reference in New Issue