central/src/central/gui/templates/change_password.html
Ubuntu 9396e5dbe8 fix(gui): dashboard polls card + CSRF exception handler
Fix A - /dashboard/polls:
- Use get_last_msg instead of pull_subscribe (no durable consumers)
- Fix subject filter: central.meta.adapter.{name}.status
- Parse correct fields: ts and ok from status message
- Handle NotFoundError gracefully when no status exists

Fix B - CSRF exception handler:
- Add global CsrfProtectError handler in __init__.py
- Return friendly "session expired" message instead of 500
- Re-render forms with error or redirect to /login
- Update templates to display error messages

Tests:
- Add get_last_msg mocking tests for polls
- Add regression test verifying no pull_subscribe
- Add CSRF handler tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-17 22:34:13 +00:00

40 lines
1.2 KiB
HTML

{% extends "base.html" %}
{% block title %}Central - Change Password{% endblock %}
{% block content %}
<article>
<header>
<h1>Change Password</h1>
</header>
{% if error %}
<p style="color: var(--pico-color-red-500);">{{ error }}</p>
{% endif %}
<form action="/change-password" method="post">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<label for="current_password">
Current Password
<input type="password" id="current_password" name="current_password" required
autocomplete="current-password" autofocus>
</label>
<label for="new_password">
New Password
<input type="password" id="new_password" name="new_password" required
autocomplete="new-password" minlength="8">
<small>Minimum 8 characters</small>
</label>
<label for="confirm_password">
Confirm New Password
<input type="password" id="confirm_password" name="confirm_password" required
autocomplete="new-password">
</label>
<button type="submit">Change Password</button>
</form>
</article>
{% endblock %}