Skip to content

Commit

Permalink
Merge branch '218-password-field-autorefill' into 'main'
Browse files Browse the repository at this point in the history
fix: password field auto-refilling when input is reset

Closes #218

See merge request yaal/canaille!215
  • Loading branch information
azmeuk committed Jan 10, 2025
2 parents ef93ccc + 76014d6 commit 09ea186
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
[0.0.59] - Unreleased
---------------------

Fixed
^^^^^
- Fix password fields auto-refilling when input is reset. :issue:`218`

Changed
^^^^^^^
- Bump to HTMX 2.0.4
Expand Down
8 changes: 8 additions & 0 deletions canaille/templates/macro/form.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@
{% set ignore_me = kwargs.update({"hx-post": ""}) %}
{% set ignore_me = kwargs.update({"hx-indicator": "closest .input", "hx-trigger": "input changed delay:500ms"}) %}
{% endif %}
{% if request.headers.get("HX-Request") and not request.headers.get("HX-Boosted") %}
{# Prevent password to be automatically refilled when reset during edition #}
{% if field.type == "PasswordField" %}
{% set ignore_me = kwargs.update({"autocomplete": "new-password"}) %}
{% else %}
{% set ignore_me = kwargs.update({"autocomplete": "off"}) %}
{% endif %}
{% endif %}

{% if container and field_visible %}
<div class="field {{ kwargs.pop('class_', '') }}
Expand Down

0 comments on commit 09ea186

Please sign in to comment.