Skip to content

Add csrf token to forms in alert profiles #3367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
2 changes: 1 addition & 1 deletion python/nav/web/templates/alertprofiles/account_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ <h5>Alerts you have permissions to recieve</h5>
<div class="column medium-4">
<h5>Alert language</h5>
<form action="{% url 'alertprofiles-language-save' %}" method="post" class="inline-form custom">
{% csrf_token %}
{{ language_form.language }}
<input type="submit" value="Save changes" class="button tiny"/>
</form>
Expand All @@ -65,4 +66,3 @@ <h5>Alert language</h5>
</div>

{% endblock %}

2 changes: 2 additions & 0 deletions python/nav/web/templates/alertprofiles/base_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ <h5>
{% endblock %}
</h5>
<form action="{% block url_remove_expression %}{% endblock %}" method="post">
{% csrf_token %}
<table class="listtable">
<thead>
<tr>
Expand Down Expand Up @@ -67,6 +68,7 @@ <h5>

<div class="addexpressionform">
<form action="{% block url_add_expression %}{% endblock %}" method="post">
{% csrf_token %}
{% block addexpression %}
<p>
<input type="hidden" name="id" value="{{ detail_id }}" />
Expand Down
1 change: 1 addition & 0 deletions python/nav/web/templates/alertprofiles/base_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
{% endblock %}

<form action="{{ form_action }}" method="post">
{% csrf_token %}

<h4>{% block captioncontent %}{% endblock %}</h4>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ <h4>
</h4>

<form action="{% url 'alertprofiles-filters-saveexpression' %}" method="post" class="custom">
{% csrf_token %}
<table class="vertitable">
<tbody>
<tr>
Expand Down
1 change: 1 addition & 0 deletions python/nav/web/templates/alertprofiles/permissions.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ <h4>Choose a group to set it's permissions</h4>

{% if selected_group %}
<form action="{% url 'alertprofiles-permissions-save' %}" method="post">
{% csrf_token %}
<table class="listtable full-width">
<caption>Set permissions for {{ selected_group.name }}</caption>

Expand Down
1 change: 1 addition & 0 deletions python/nav/web/templates/alertprofiles/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ <h4>Profiles</h4>


<form action="{% url 'alertprofiles-profile-remove' %}" method="post">
{% csrf_token %}
<table class="listtable">
<thead>
<tr>
Expand Down
3 changes: 2 additions & 1 deletion python/nav/web/templates/alertprofiles/profile_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

{% block headercontent %}
{% if detail_id %}
Profile details
Profile details
{% else %}
New profile
{% endif %}
Expand Down Expand Up @@ -40,6 +40,7 @@
<h4>Time periods</h4>

<form action="{% url 'alertprofiles-profile-timeperiod-remove' %}" method="post">
{% csrf_token %}
{% include "alertprofiles/timeperiods.html" %}
<p>
<input type="hidden" name="profile" value="{{ detail_id }}" />
Expand Down
2 changes: 2 additions & 0 deletions python/nav/web/templates/alertprofiles/subscription_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ <h4>
{% if subscriptions %}

<form action="{% url 'alertprofiles-profile-timeperiod-subscription-remove' %}" method="post">
{% csrf_token %}
<table class="listtable full-width">
<thead>
<tr>
Expand Down Expand Up @@ -67,6 +68,7 @@ <h4>

<div class="addexpressionform">
<form action="{% url 'alertprofiles-profile-timeperiod-subscription-add' %}" method="post">
{% csrf_token %}
<h5>{{ editing|yesno:"Edit,Add new" }} subscription</h5>
<div class="formcontainer">

Expand Down
Loading