Skip to content

Commit

Permalink
#8 #31 #21 temporarily disable CSRF
Browse files Browse the repository at this point in the history
  • Loading branch information
mrwunderbar666 committed Jul 26, 2023
1 parent 84f1bd1 commit 41b3ab4
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
5 changes: 4 additions & 1 deletion flaskinventory/add/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,10 @@ def new(dgraph_type=None, draft=None, populate_form: dict = None):

fields = list(form.data.keys())
fields.remove('submit')
fields.remove('csrf_token')
try:
fields.remove('csrf_token')
except:
pass

if dgraph_type in ['Tool', 'ScientificPublication', 'Dataset', 'Corpus']:
show_sidebar = True
Expand Down
2 changes: 1 addition & 1 deletion flaskinventory/static/js/networkplot.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ function MakeNetworkPlot(uid, endpoint, divId) {
fetch(endpoint, {
method: 'POST',
headers: {
'X-CSRFToken': csrftoken,
// 'X-CSRFToken': csrftoken,
'Content-Type': 'application/json',
},
body: JSON.stringify(uid),
Expand Down
1 change: 0 additions & 1 deletion flaskinventory/templates/add/newsource.html
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,6 @@ <h4 class="mb-4">

<script>
$SCRIPT_ROOT = {{ request.script_root|tojson|safe }};
const csrftoken = "{{ csrf_token() }}";

{% include 'add/newsource.js' %}

Expand Down
2 changes: 1 addition & 1 deletion flaskinventory/templates/add/newsource.js
Original file line number Diff line number Diff line change
Expand Up @@ -1451,7 +1451,7 @@ function submitForm(endpoint, form, callback) {
var url = endpoint;
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("X-CSRFToken", csrftoken);
// xhr.setRequestHeader("X-CSRFToken", csrftoken);
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
Expand Down
3 changes: 1 addition & 2 deletions flaskinventory/templates/edit/audience.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ <h3 class="mb-3">Edit Audience Size: {{entry.get('name')}} <span class="text-mut
const htmltable = document.getElementById('audience-size')
const htmlcols = document.querySelector('#audience-size tr')
const htmlrows = document.querySelector('#audience-size tbody')
const csrftoken = "{{ csrf_token() }}"
const endpoint = "{{ url_for('edit.source_audience', uid=entry.get('uid') ) }}"

function editRow(rowNum) {
Expand Down Expand Up @@ -144,7 +143,7 @@ <h3 class="mb-3">Edit Audience Size: {{entry.get('name')}} <span class="text-mut
var url = endpoint;
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("X-CSRFToken", csrftoken);
// xhr.setRequestHeader("X-CSRFToken", csrftoken);
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
Expand Down
1 change: 0 additions & 1 deletion flaskinventory/templates/view/elements/ownership.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ <h5 class="flex-grow-1">Ownership Structure</h5>
<script>

$SCRIPT_ROOT = {{ request.script_root|tojson|safe }};
const csrftoken = "{{ csrf_token() }}";
const data = { uid: "{{ entry.uid }}" };
$ENDPOINT = "{{ url_for( 'endpoint.ownership' ) }}"

Expand Down

0 comments on commit 41b3ab4

Please sign in to comment.