Prevent Login Form from Filling in details

I have a login form on my dashboard. However, whenever I go to the login page my username and password is already filled in. Is there a way to prevent the browser from storing and autofilling that information?

I tried turning off autocomplete on the password field …

<input type="password" class="form-control form-control-sm" id="inputPassword" name="inputPassword" aria-describedby="input2_help" value="" autocomplete="off">

Hi Brad (my favourite ACP),

Have a look at
https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion

TLTR: Change the name of the inputs to something that the browser will not recognise such as mypassword. In doing so, make sure that the back end recognises the name change(s).

1 Like

You could also try

autocomplete="off"

in either/both the form and/or the input. I think different browsers behave slightly differently so I would put it in both the form and the input.

I have autocomplete turned off on both the field and the form itself.

Do you have any browser plugins which auto-populate fields? Something like LastPass?

No plugins … found some useful info here though.

“If a browser keeps on making suggestions even after setting autocomplete to off, then you have to change the name attribute of the input element.”

Yep, renaming the fields will definitely sort it. Maybe add the domain to the beginning so you have something like bradcomusername and bradcompassword. That should mean there’s near to no risk of another site somewhere having the same name.

1 Like

You probably saved your username and password with the browser so it remembers them. Just go to the browser settings, saved passwords and clear those for this site.

None of what is mentioned in the MDN article or elsewhere worked for me.

Putting this in the input tag worked : autocomplete="new-password"

1 Like