Skip to content

Commit

Permalink
Don't expose session keys in views
Browse files Browse the repository at this point in the history
  • Loading branch information
Bouke committed Jan 24, 2020
1 parent 671b38c commit f0c4077
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
2 changes: 1 addition & 1 deletion tests/tests.py
Expand Up @@ -88,8 +88,8 @@ def test_list(self):
user_agent='Firefox')
response = self.client.get(reverse('user_sessions:session_list'))
self.assertContains(response, 'Active Sessions')
self.assertContains(response, 'End Session', 3)
self.assertContains(response, 'Firefox')
self.assertNotContains(response, 'ABC123')

def test_delete(self):
session_key = self.client.cookies[settings.SESSION_COOKIE_NAME].value
Expand Down
11 changes: 0 additions & 11 deletions user_sessions/templates/user_sessions/session_list.html
Expand Up @@ -13,7 +13,6 @@ <h1>{% trans "Active Sessions" %}</h1>
<th>{% trans "Location" %}</th>
<th>{% trans "Device" %}</th>
<th>{% trans "Last Activity" %}</th>
<th>{% trans "End Session" %}</th>
</tr>
</thead>
{% for object in object_list %}
Expand All @@ -27,16 +26,6 @@ <h1>{% trans "Active Sessions" %}</h1>
{% blocktrans with time=object.last_activity|timesince %}{{ time }} ago{% endblocktrans %}
{% endif %}
</td>
<td>
<form method="post" action="{% url 'user_sessions:session_delete' object.pk %}">
{% csrf_token %}
{% if object.session_key == session_key %}
<button type="submit" class="btn btn-xs btn-link">{% trans "End Session" %}</button>
{% else %}
<button type="submit" class="btn btn-xs btn-warning">{% trans "End Session" %}</button>
{% endif %}
</form>
</td>
</tr>
{% endfor %}
</table>
Expand Down

0 comments on commit f0c4077

Please sign in to comment.