From aa916b0c9711f419e967cc83c2634f90aef6a44b Mon Sep 17 00:00:00 2001 From: Adam Ruzicka Date: Mon, 17 Feb 2025 09:38:11 +0100 Subject: [PATCH] Fixes #38217 - Set autocomplete attribute on name inputs to prevent a password manager from suggesting saved credentials in various name fields. --- app/helpers/form_helper.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/helpers/form_helper.rb b/app/helpers/form_helper.rb index 79afb29a3e1..020c6343c5c 100644 --- a/app/helpers/form_helper.rb +++ b/app/helpers/form_helper.rb @@ -2,7 +2,10 @@ module FormHelper def text_f(f, attr, options = {}) field(f, attr, options) do addClass options, "form-control" - options[:focus_on_load] = true if options[:focus_on_load].nil? && attr.to_s == 'name' + if attr.to_s == 'name' + options[:focus_on_load] ||= true + options[:autocomplete] ||= "section-#{f.object_name} name" + end f.text_field attr, options end end