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 hidden crsf token input not accepting autocomplete #48987

Closed
wants to merge 1 commit into from

Conversation

Khuthaily
Copy link

This PR addresses the following issue when validating HTML code: "An input element with a type attribute whose value is hidden must not have an autocomplete attribute whose value is on or off."

This PR addresses the following issue when validating HTML code: "An `input` element with a `type` attribute whose value is `hidden` must not have an `autocomplete` attribute whose value is `on` or `off`."
@@ -323,7 +323,7 @@ function cookie($name = null, $value = null, $minutes = 0, $path = null, $domain
*/
function csrf_field()
{
return new HtmlString('<input type="hidden" name="_token" value="'.csrf_token().'" autocomplete="off">');
return new HtmlString('<input type="text" style="display:none" name="_token" value="'.csrf_token().'">');
Copy link
Contributor

Choose a reason for hiding this comment

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

I would argue that simply removing the autocomplete attribute would be best. Hidden input types are an established type and changing this could potentially have reaching effects.

Copy link
Member

Choose a reason for hiding this comment

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

See #48371

Copy link

Choose a reason for hiding this comment

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

Please, respect W3C!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants