fix: add CSRF tokens to admin forms and HTML5 validation hints
Add hidden CSRF token inputs to admin profile, groups, and invite forms. Add maxlength, pattern, and title attributes to invite input. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d4acb46cf5
commit
56c177c817
2 changed files with 6 additions and 1 deletions
|
|
@ -11,6 +11,7 @@
|
||||||
<section>
|
<section>
|
||||||
<h2>Profile</h2>
|
<h2>Profile</h2>
|
||||||
<form hx-post="/admin/users/{{ target_user.userid }}/profile" hx-target="#profile-status" hx-swap="innerHTML">
|
<form hx-post="/admin/users/{{ target_user.userid }}/profile" hx-target="#profile-status" hx-swap="innerHTML">
|
||||||
|
<input type="hidden" name="csrf_token" value="{{ csrf_token_processor(request) }}">
|
||||||
<div>
|
<div>
|
||||||
<label for="given_name">Given name</label>
|
<label for="given_name">Given name</label>
|
||||||
<input type="text" id="given_name" name="given_name" value="{{ target_user.given_name or '' }}" maxlength="255">
|
<input type="text" id="given_name" name="given_name" value="{{ target_user.given_name or '' }}" maxlength="255">
|
||||||
|
|
@ -48,6 +49,7 @@
|
||||||
<h2>Groups</h2>
|
<h2>Groups</h2>
|
||||||
<div id="groups-section">
|
<div id="groups-section">
|
||||||
<form hx-post="/admin/users/{{ target_user.userid }}/groups" hx-target="#groups-status" hx-swap="innerHTML">
|
<form hx-post="/admin/users/{{ target_user.userid }}/groups" hx-target="#groups-status" hx-swap="innerHTML">
|
||||||
|
<input type="hidden" name="csrf_token" value="{{ csrf_token_processor(request) }}">
|
||||||
<div id="group-list">
|
<div id="group-list">
|
||||||
{% for group in target_user.groups %}
|
{% for group in target_user.groups %}
|
||||||
<span class="group-tag">{{ group }}</span>
|
<span class="group-tag">{{ group }}</span>
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,11 @@
|
||||||
<section>
|
<section>
|
||||||
<h2>Create invite</h2>
|
<h2>Create invite</h2>
|
||||||
<form hx-post="/admin/invite" hx-target="#invite-status" hx-swap="innerHTML">
|
<form hx-post="/admin/invite" hx-target="#invite-status" hx-swap="innerHTML">
|
||||||
|
<input type="hidden" name="csrf_token" value="{{ csrf_token_processor(request) }}">
|
||||||
<div class="admin-search">
|
<div class="admin-search">
|
||||||
<input type="text" name="username" placeholder="Username for new invite" required>
|
<input type="text" name="username" placeholder="Username or email for new invite" required
|
||||||
|
maxlength="255" pattern="[a-zA-Z0-9_.@-]+"
|
||||||
|
title="Letters, digits, dots, hyphens, underscores, and @">
|
||||||
<button type="submit">Create invite</button>
|
<button type="submit">Create invite</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue