Skip to content

Commit

Permalink
Merge pull request #2300 from alphagov/set-autocomplete-on-input-fields
Browse files Browse the repository at this point in the history
Set autocomplete attribute on input elements appropriately
  • Loading branch information
floehopper authored Aug 9, 2023
2 parents a9ba6b6 + 57687ef commit 06fed2d
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 13 deletions.
4 changes: 2 additions & 2 deletions app/views/api_users/_form_fields.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

<p class="form-group">
<%= f.label :name %>
<%= f.text_field :name, autofocus: true, class: 'form-control input-md-6', required: true %>
<%= f.text_field :name, autofocus: true, autocomplete: "off", class: 'form-control input-md-6', required: true %>
</p>

<p class="form-group">
<%= f.label :email %>
<%= f.text_field :email, class: 'form-control input-md-6', required: true %>
<%= f.text_field :email, autocomplete: "off", class: 'form-control input-md-6', required: true %>
</p>
2 changes: 2 additions & 0 deletions app/views/api_users/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
id: "api_user_name",
error_items: @api_user.errors.full_messages_for(:name).map {|message| { text: message } },
value: @api_user.name,
autocomplete: "off",
} %>

<%= render "govuk_publishing_components/components/input", {
Expand All @@ -35,6 +36,7 @@
type: "email",
error_items: @api_user.errors.full_messages_for(:email).map {|message| { text: message } },
value: @api_user.email,
autocomplete: "off",
} %>

<%= render "govuk_publishing_components/components/button", {
Expand Down
3 changes: 2 additions & 1 deletion app/views/devise/confirmations/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
text: "Your password"
},
name: "user[password]",
type: "password"
type: "password",
autocomplete: "current-password"
} %>

<%= render "govuk_publishing_components/components/button", {
Expand Down
5 changes: 4 additions & 1 deletion app/views/devise/passwords/_change_password_panel.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
text: "Current password"
},
name: "user[current_password]",
type: "password"
type: "password",
autocomplete: "current-password"
} %>
<% end %>

Expand All @@ -17,6 +18,7 @@
hint: "Passwords must be at least 10 characters, shouldn’t include part of your email address and must be complex. Consider using whole sentences (with spaces), lyrics or phrases to make your password more memorable.",
name: "user[password]",
type: "password",
autocomplete: "new-password",
data: {
'email-parts': user_email_tokens(user).join(","),
'min-password-length': minimum_password_length
Expand All @@ -31,6 +33,7 @@
},
name: "user[password_confirmation]",
type: "password",
autocomplete: "new-password"
} %>
</div>

Expand Down
3 changes: 2 additions & 1 deletion app/views/devise/passwords/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
text: "Email address"
},
name: "user[email]",
type: "email"
type: "email",
autocomplete: "email"
} %>

<%= render "govuk_publishing_components/components/button", {
Expand Down
6 changes: 4 additions & 2 deletions app/views/devise/sessions/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@
name: "user[email]",
type: "email",
autofocus: true,
tabindex: 0
tabindex: 0,
autocomplete: "email",
} %>

<%= render "govuk_publishing_components/components/input", {
label: {
text: "Password"
},
name: "user[password]",
type: "password"
type: "password",
autocomplete: "current-password"
} %>

<%= render "govuk_publishing_components/components/button", {
Expand Down
6 changes: 6 additions & 0 deletions app/views/doorkeeper_applications/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
name: "doorkeeper_application[name]",
type: "text",
value: @application.name,
autocomplete: "off"
} %>


Expand All @@ -39,6 +40,7 @@
name: "doorkeeper_application[description]",
type: "text",
value: @application.description,
autocomplete: "off"
} %>

<%= render "govuk_publishing_components/components/input", {
Expand All @@ -49,6 +51,7 @@
type: "text",
hint: "Used to link to the app on the dashboard",
value: @application.home_uri,
autocomplete: "off"
} %>

<%= render "govuk_publishing_components/components/input", {
Expand All @@ -59,6 +62,7 @@
type: "text",
hint: "The app should expect this URI. Used in the signin redirect dance.",
value: @application.redirect_uri,
autocomplete: "off"
} %>

<%= render "govuk_publishing_components/components/input", {
Expand All @@ -69,6 +73,7 @@
type: "text",
hint: "The app has a copy of this. Used in the signin redirect dance.",
value: @application.uid,
autocomplete: "off"
} %>

<%= render "govuk_publishing_components/components/input", {
Expand All @@ -79,6 +84,7 @@
type: "text",
hint: "The app has a copy of this. Used in the signin redirect dance.",
value: @application.secret,
autocomplete: "off"
} %>

<%# TODO: use a checkbox component for this %>
Expand Down
1 change: 1 addition & 0 deletions app/views/suspensions/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
},
name: "user[reason_for_suspension]",
value: @suspension.reason_for_suspension,
autocomplete: "off",
error_items: @suspension.errors.full_messages_for(:reason_for_suspension).map {|message| { text: message } },
} %>

Expand Down
1 change: 1 addition & 0 deletions app/views/two_step_verification_exemptions/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
Please provide a reason for granting this exemption above.
Please note - the reason you enter will be visible to the user, and any admins who have the ability to edit the user.
},
autocomplete: "off",
error_items: @exemption.errors.full_messages_for(:reason).map { |message| { text: message } }
} %>

Expand Down
4 changes: 2 additions & 2 deletions app/views/users/_form_fields.html.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<p class="form-group">
<%= f.label :name %>
<%= f.text_field :name, autofocus: true, class: 'form-control input-md-6 ' %>
<%= f.text_field :name, autofocus: true, autocomplete: "off", class: 'form-control input-md-6 ' %>
</p>

<p class="form-group">
<%= f.label :email %>
<%= f.text_field :email, class: 'form-control input-md-6 add-label-margin' %>
<%= f.text_field :email, autocomplete: "off", class: 'form-control input-md-6 add-label-margin' %>
<% if f.object.persisted? %>
<% if f.object.invited_but_not_yet_accepted? %>
<span class="help-block">Changes will trigger a new signup email.</span>
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/_user_filter.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<%= hidden_field_tag :organisation, params[:organisation] if params[:organisation] %>
<%= hidden_field_tag :two_step_status, params[:two_step_status] if params[:two_step_status] %>
<%= label_tag 'filter', 'Name or email', class: 'add-right-margin sr-only' %>
<%= text_field_tag "filter", params[:filter], placeholder: "Name or email", class: 'form-control filter-by-name-field' %>
<%= text_field_tag "filter", params[:filter], placeholder: "Name or email", autocomplete: "off", class: 'form-control filter-by-name-field' %>
<%= submit_tag "Filter", class: "btn btn-default" %>
<% end %>
</li>
Expand Down
4 changes: 2 additions & 2 deletions app/views/users/_user_filter_group.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
<li class="list-filter">
<form>
<label for="organisation-list-filter" class="rm">Search organisations</label>
<input id="organisation-list-filter" type="text" class="list-filter-input form-control js-filter-list-input" placeholder="Search organisations">
<input id="organisation-list-filter" type="text" class="list-filter-input form-control js-filter-list-input" placeholder="Search organisations" autocomplete="off">
</form>
</li>
<% end %>
<% if filter_type == :permission %>
<li class="list-filter">
<form>
<label for="permission-list-filter" class="rm">Search permissions</label>
<input id="permission-list-filter" type="text" class="list-filter-input form-control js-filter-list-input" placeholder="Search permissions">
<input id="permission-list-filter" type="text" class="list-filter-input form-control js-filter-list-input" placeholder="Search permissions" autocomplete="off">
</form>
</li>
<% end %>
Expand Down
3 changes: 2 additions & 1 deletion app/views/users/edit_email_or_password.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
type: "email",
id: "user_email",
value: current_user.email,
hint: "Changing your email address doesn’t take effect until you follow the link in a confirmation email sent to the new address."
hint: "Changing your email address doesn’t take effect until you follow the link in a confirmation email sent to the new address.",
autocomplete: "email"
} %>
<%= render "govuk_publishing_components/components/button", {
text: "Change email"
Expand Down

0 comments on commit 06fed2d

Please sign in to comment.