From fdeb2997fb2e17cffba5e162e5603157ad1d940b Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Thu, 29 Sep 2016 10:21:08 +0100 Subject: [PATCH] Stop whitelist form autocompleting The browser tries to be helpful by autofilling email addresses and phone numbers. But it gets confused and tries to fill all the fields with the same email address or phone number. This looks broken. This commit disables autocomplete for these form fields. --- app/templates/components/list-entry.html | 4 +++- app/templates/views/api/whitelist.html | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/templates/components/list-entry.html b/app/templates/components/list-entry.html index 6c0237d2f..4bf239b5d 100644 --- a/app/templates/components/list-entry.html +++ b/app/templates/components/list-entry.html @@ -1,7 +1,8 @@ {% macro list_entry( field, item_name, - hint='' + hint='', + autocomplete=True ) %} {% if error %} @@ -40,6 +41,7 @@ id="input-{{ field.name }}-{{ index }}" class="form-control form-control-1-1" value="{{ field.data[index] }}" + {% if not autocomplete %}autocomplete="off"{% endif %} /> {% endfor %} diff --git a/app/templates/views/api/whitelist.html b/app/templates/views/api/whitelist.html index cc859feb4..47534da1b 100644 --- a/app/templates/views/api/whitelist.html +++ b/app/templates/views/api/whitelist.html @@ -22,11 +22,13 @@ {{ list_entry( form.email_addresses, item_name='email address', + autocomplete=False ) }} {{ list_entry( form.phone_numbers, item_name='phone number', + autocomplete=False ) }}