I have a form field where users can change their passwords, but if they set their settings to remember passwords, their password shows up. Is there a way to make the field always empty? So that they always have to type their password.
<label for="oldpassword" class="styled">Old password:</label>
<input type="password" id="oldpassword" name="oldpassword"/><br />
As another security precaution, a password field stores its value as an array of characters, rather than as a string. Like an ordinary text field, a password field fires an action event when the user indicates that text entry is complete, for example by pressing the Enter button.
The <input type="password"> defines a password field (characters are masked). Note: Any forms involving sensitive information like passwords should be served over HTTPS. Tip: Always add the <label> tag for best accessibility practices!
Use autocomplete="current-password" and id="current-password" for the password input in a sign-in form, or the input for the user's old password in a change-password form. This tells the browser that you want it to use the current password that it has stored for the site.
If you are defining a user management page where a user can specify a new password for another person, and therefore you want to prevent autofilling of password fields, you can use autocomplete="new-password" .
You could clear the old password shortly after the page loads.
Using jQuery:
setTimeout(
function() { $(':password').val(''); },
1000 //1,000 milliseconds = 1 second
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With