Set autocomplete attributes on username & password fields

This commit is contained in:
Karina Kwiatek 2022-06-27 23:33:25 +02:00 committed by Karina Kwiatek
parent 9dedf447a6
commit 805e3504c7
4 changed files with 11 additions and 11 deletions

View File

@ -9,10 +9,10 @@
= render "devise/shared/error_messages", resource: resource = render "devise/shared/error_messages", resource: resource
= render "layouts/messages" = render "layouts/messages"
= f.text_field :screen_name, autofocus: true = f.text_field :screen_name, autofocus: true, autocomplete: :username
= f.email_field :email, autofocus: false = f.email_field :email, autofocus: false, autocomplete: :email
= f.password_field :password, autocomplete: :off = f.password_field :password, autocomplete: "new-password"
= f.password_field :password_confirmation, autocomplete: :off = f.password_field :password_confirmation, autocomplete: "new-password"
- if APP_CONFIG.dig(:hcaptcha, :enabled) - if APP_CONFIG.dig(:hcaptcha, :enabled)
= hcaptcha_tags = hcaptcha_tags

View File

@ -8,8 +8,8 @@
%h1.mb-3.mt-0= t(".title") %h1.mb-3.mt-0= t(".title")
= bootstrap_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| = bootstrap_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
= f.text_field :login, autofocus: true = f.text_field :login, autofocus: true, autocomplete: :username
= f.password_field :password, autocomplete: :off = f.password_field :password, autocomplete: "current-password"
- if devise_mapping.rememberable? - if devise_mapping.rememberable?
= f.check_box :remember_me = f.check_box :remember_me

View File

@ -7,7 +7,7 @@
%span{ aria: { hidden: true } } × %span{ aria: { hidden: true } } ×
%span.sr-only= t("voc.close") %span.sr-only= t("voc.close")
.modal-body .modal-body
= f.password_field :current_password, autocomplete: :off = f.password_field :current_password, autocomplete: "current-password"
.modal-footer .modal-footer
%button.btn.btn-default{ data: { dismiss: :modal }, type: :button }= t("voc.cancel") %button.btn.btn-default{ data: { dismiss: :modal }, type: :button }= t("voc.cancel")
= f.primary = f.primary

View File

@ -4,14 +4,14 @@
= render "modal/password", f: f = render "modal/password", f: f
= render "devise/shared/error_messages", resource: resource = render "devise/shared/error_messages", resource: resource
= f.text_field :screen_name, autofocus: true = f.text_field :screen_name, autofocus: true, autocomplete: :username
= f.email_field :email = f.email_field :email, autocomplete: :email
- if devise_mapping.confirmable? && resource.pending_reconfirmation? - if devise_mapping.confirmable? && resource.pending_reconfirmation?
.alert.alert-info= raw t(".email_confirm", resource: resource.unconfirmed_email) .alert.alert-info= raw t(".email_confirm", resource: resource.unconfirmed_email)
= f.password_field :password, autocomplete: :off, help: t(".help.password") = f.password_field :password, autocomplete: "new-password", help: t(".help.password")
= f.password_field :password_confirmation, autocomplete: :off = f.password_field :password_confirmation, autocomplete: "new-password"
%button.btn.btn-primary{ data: { target: "#modal-passwd", toggle: :modal, type: :button } } %button.btn.btn-primary{ data: { target: "#modal-passwd", toggle: :modal, type: :button } }
= t("voc.save") = t("voc.save")