Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Chrome autofilling password when editing a schema #9296

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

liu-samuel
Copy link
Contributor

@liu-samuel liu-samuel commented Oct 22, 2024

Adds autocomplete attribute to prevent password datatype default values from using password manager values

@miq-bot add-label bug
@miq-bot add-reviewer @GilbertCherrie

Comment on lines 2321 to 2323
if fld['datatype'] == 'password'
fld[field] = params["fields_password_value_#{i}".to_sym] if params["fields_password_value_#{i}".to_sym]
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this change? Doesn't this just do what the field already does?

Copy link
Contributor Author

@liu-samuel liu-samuel Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After I add or delete a row, it sends a second fields_form_field_changed request with a payload with a password_field_value and the original value in default value even though the datatype isnt a password, so I added this check to make sure it was for a non password type

So then when a deletion or addition happens afterwards, the value is set back to the original
Screenshot 2024-10-22 at 4 06 34 PM

@@ -61,6 +61,7 @@
= password_field_tag("fields_password_value_#{i}", '',
:placeholder => placeholder_if_present(default_value),
:style => field['datatype'] == "password" ? "" : "display:none",
:autocomplete => "new-password",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking we should just turn autocomplete off. The reason is that it's unlikely that an automate password is something that someone would want to save in their browser and then fill in later. That's usually reserved for the main login to the application, but here I don't think it makes sense.

Copy link
Contributor Author

@liu-samuel liu-samuel Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this because the passwords are auto completing right now. I looked around on how to disable it and came across this, and once I added it the auto complete went away.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, new-password is definitely better than nothing., however, I was more thinking that off might be an even better choice. See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete for more details on the values.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then again https://stackoverflow.com/questions/15738259/disabling-chrome-autofill seems to be saying that Chrome is ignoring the value

@Fryguy Fryguy self-assigned this Oct 22, 2024
@Fryguy Fryguy merged commit 0960088 into ManageIQ:master Oct 29, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants