34bf5b5ac2
- embedded Go templates + vanilla ES-module JS + hand-written CSS, no build step
- exact §10 beige light / dark design tokens, square edges (radius 2px),
system font stack, visible focus rings
- theme toggle persisted to localStorage and the user profile
- login/register/change-password pages wired to the auth API
- profile page: avatar upload (image-sniffed, old file cleanup), bio,
contacts, arbitrary extra key/value fields, optimistic-concurrency 409
- role-based top navigation with placeholders for later-phase areas
- GET /files/{id} with scope-based access (session) or signed token (§5.1)
- security headers incl. CSP without unsafe-inline scripts
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
24 lines
703 B
JavaScript
24 lines
703 B
JavaScript
import { api } from '/static/js/api.js';
|
|
|
|
const form = document.getElementById('change-password-form');
|
|
const errorBox = document.getElementById('error');
|
|
|
|
form.addEventListener('submit', async (e) => {
|
|
e.preventDefault();
|
|
errorBox.textContent = '';
|
|
const newPw = document.getElementById('new').value;
|
|
if (newPw !== document.getElementById('confirm').value) {
|
|
errorBox.textContent = 'New passwords do not match.';
|
|
return;
|
|
}
|
|
try {
|
|
await api('POST', '/api/v1/auth/change-password', {
|
|
currentPassword: document.getElementById('current').value,
|
|
newPassword: newPw,
|
|
});
|
|
window.location.href = '/';
|
|
} catch (err) {
|
|
errorBox.textContent = err.message;
|
|
}
|
|
});
|