Files
Evection/templates/core/_sidebar.html
T
ksmithandClaude Sonnet 5 1a8ae95db0 Fix logout 405 — Django's LogoutView only accepts POST
The sidebar's "Log out" was a plain <a href> GET link. Django 5's
LogoutView stopped accepting GET (CSRF hardening — a bare link or even an
<img> tag could otherwise log someone out), so clicking it 405'd instead
of logging out. Changed it to a POST form, matching every other
state-changing action in the sidebar/app (unsubscribe, delete tag, etc.).

Extended .sidebar-top-nav's styling to cover a <button> the same as an
<a>, so the form-submit button looks identical to the other nav items.

No existing test exercised logout at all — added one for the POST case
and one confirming GET now correctly 405s, then verified end-to-end
against the running dev server (login, POST /logout/, confirm the session
is gone).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-30 22:01:06 -06:00

92 lines
3.8 KiB
HTML

{% load static %}
<nav class="sidebar" aria-label="Feeds and tags">
<div class="sidebar-brand">
<a href="{% url 'reader:stream' %}" aria-label="Evection">
<img src="{% static 'img/brand-full-dark.png' %}" alt="Evection" class="brand-wordmark-dark">
<img src="{% static 'img/brand-full-light.png' %}" alt="Evection" class="brand-wordmark-light">
</a>
</div>
<a href="{% url 'feeds:subscription_list' %}" class="sidebar-manage-btn">Subscription management</a>
<ul class="sidebar-top-nav">
<li>
<a href="{% url 'reader:stream' %}?filter=all"
class="{% if not request.GET.tag and not request.GET.feed and request.GET.filter == 'all' %}active{% endif %}">
All articles
</a>
</li>
<li>
<a href="{% url 'reader:stream' %}?filter=starred"
class="{% if request.GET.filter == 'starred' %}active{% endif %}">
Favourites{% if sidebar_starred_count %} ({{ sidebar_starred_count }}){% endif %}
</a>
</li>
<li>
<a href="{% url 'reader:stream' %}?filter=saved"
class="{% if request.GET.filter == 'saved' %}active{% endif %}">
Saved for later
</a>
</li>
</ul>
{% for entry in sidebar_tag_groups %}
<details class="sidebar-section" open>
<summary>
<a href="{% url 'reader:stream' %}?tag={{ entry.tag.pk }}"
class="sidebar-tag-link{% if request.GET.tag == entry.tag.pk|stringformat:'s' %} active{% endif %}">{{ entry.tag.name }}</a>
</summary>
{% if entry.subscriptions %}
<ul class="sidebar-item-list">
{% for subscription in entry.subscriptions %}
<li>
<a href="{% url 'reader:stream' %}?feed={{ subscription.feed_id }}"
class="sidebar-feed-link{% if request.GET.feed == subscription.feed_id|stringformat:'s' %} active{% endif %}">
{% if subscription.feed.favicon_url %}<img src="{{ subscription.feed.favicon_url }}" alt="" class="feed-favicon">{% endif %}
<span>{{ subscription.display_title }}</span>
</a>
{% if subscription.unread_count %}<span class="unread-count">{{ subscription.unread_count }}</span>{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
</details>
{% endfor %}
{% if sidebar_untagged %}
<details class="sidebar-section" open>
<summary>Untagged</summary>
<ul class="sidebar-item-list">
{% for subscription in sidebar_untagged %}
<li>
<a href="{% url 'reader:stream' %}?feed={{ subscription.feed_id }}"
class="sidebar-feed-link{% if request.GET.feed == subscription.feed_id|stringformat:'s' %} active{% endif %}">
{% if subscription.feed.favicon_url %}<img src="{{ subscription.feed.favicon_url }}" alt="" class="feed-favicon">{% endif %}
<span>{{ subscription.display_title }}</span>
</a>
{% if subscription.unread_count %}<span class="unread-count">{{ subscription.unread_count }}</span>{% endif %}
</li>
{% endfor %}
</ul>
</details>
{% endif %}
<ul class="sidebar-top-nav sidebar-footer-nav">
<li><a href="{% url 'articles:tag_list' %}">Manage tags</a></li>
<li><a href="{% url 'rules:rule_list' %}">Rules</a></li>
{% if request.user.is_staff %}<li><a href="{% url 'core:dashboard' %}">Dashboard</a></li>{% endif %}
<li>
<form method="post" action="{% url 'accounts:logout' %}">
{% csrf_token %}
<button type="submit">Log out</button>
</form>
</li>
</ul>
<div class="theme-switcher" role="group" aria-label="Theme">
<button type="button" data-theme-choice="light">Light</button>
<button type="button" data-theme-choice="dark">Dark</button>
<button type="button" data-theme-choice="system">System</button>
</div>
</nav>