Commit 9b6dd5b1 authored by enured's avatar enured
Browse files

S13827 Better fix for ignoring autofill. Should work with every browser. For...

S13827 Better fix for ignoring autofill. Should work with every browser. For type password set autocomplete to new-password and every password element gets an own input type=text tag which is not displayed.
parent 240fcda6
Pipeline #6894 passed with stage
in 1 minute and 48 seconds
......@@ -1493,8 +1493,8 @@ abstract class AbstractBuildForm {
// $attribute .= Support::doAttribute('value', htmlentities($value, ENT_QUOTES, 'UTF-8'), false);
}
// Set for text autocomplete to new-password to ignore autofill and for password to give choice of generated password for user
if($formElement[FE_TYPE] === 'text' || $formElement[FE_TYPE] === 'password') {
// Set for password to give choice of generated password for user and not autofill password field
if($formElement[FE_TYPE] === 'password') {
$attribute .= Support::doAttribute('autocomplete', 'new-password');
}
......@@ -1547,6 +1547,11 @@ abstract class AbstractBuildForm {
$input .= $formElement[FE_INPUT_EXTRA_BUTTON_INFO];
}
//Generate an empty input type text to ignore autocomplete in other elements
if($formElement[FE_TYPE] === 'password'){
$input = '<input type="text" style="display:none;">'.$input;
}
return $input;
}
......@@ -3237,7 +3242,6 @@ abstract class AbstractBuildForm {
$attribute .= HelperFormElement::getAttributeList($formElement, [FE_INPUT_AUTOCOMPLETE, 'autofocus', 'placeholder']);
$attribute .= Support::doAttribute('data-load', ($formElement[FE_DYNAMIC_UPDATE] === 'yes') ? 'data-load' : '');
$attribute .= Support::doAttribute('title', $formElement[FE_TOOLTIP]);
$attribute .= Support::doAttribute('autocomplete', 'new-password');
$pattern = Sanitize::getInputCheckPattern($formElement[FE_CHECK_TYPE], $formElement[FE_CHECK_PATTERN], '', $sanitizeMessage);
$attribute .= ($pattern === '') ? '' : 'pattern="' . $pattern . '" ';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment