javascript - Prevent Firefox from autocompleting any form with password field -
we have single page application, built angularjs. many apps have login form 1 input[type=text]
(email) , 1 input[type=password]
(password). alright. firefox saves data (if user confirms) , can autocomplete form next time.
we have form editing or creating user. of course there input fields of type text
, password
, too. firefox autocompletes these fields in case user.
our user edit form:
<!--span>made selectize directive: no id, no name<span--> <input type="text" tabindex="0"></input> <input id="whatever" autocomplete="off" class="form-control" name="hi" ng-minlength="settings.loginsettings.passwordminlength" ng-model-options="{debounce: {'default': 500, 'blur': 0}}" ng-model="userdata.password" ng-required="!userdata.id" placeholder="{{ '_settings.password' | translate }}" type="password" />
our form has different id
login form, has autocomplete="off"
attribute (which turned off in ff >= 30, although apparently html5 standard) , password field has different name
, id
attributes 1 in login form. other suggestions, adding 1 more hidden (style="display: none"
) text input field not work.
i've created dirty js hack in user edit controller, empties dirty fields , related model fields, user see strange things going on on page.
most discussions of issue here quite old, on other hand tons of apps have login form and user editing form. guess missing simple here?
thanks advice!
i have fixed same issue adding fake fields above real fields.
<input id="prevent_autofill" type="text" style="display:none;" value="" name="prevent_autofill"></input> <input id="password_fake" type="password" style="display:none;" value="" name="password_fake"></input> <input id="real_login" type="text" value="" name="real_login"></input> <input id="real_password" type="password" value="" name="real_password"></input>
Comments
Post a Comment