Often on a website, if I enter the wrong password by mistake, I get a page back that indicates the wrong credentials, but Chrome (Or whatever) prompts me with "Would you like to remember this password?"
Is there any way to hint to the browser that now is not the time to ask, so that it only prompts if the user enters a correct password?
Method 1: One of the known methods is to use autocomplete attribute to prevent browser to remember the password. In the input field, if we define autocomplete=”off” then many times the input value is not remembered by the browser.
The Browser Security RiskThis database of passwords stored in your browser is not as secure as you might think. Depending on the browser, if hackers gained access to your computer, they could actually extract the contents of the database – and get access to ALL your private logins.
If Chrome doesn't offer to save the password, make sure that the password-saving feature is actually enabled. To check this, go to Settings > Autofill > Passwords. If the Offer to save passwords option is switched off, toggle it on. Now, Chrome will offer you to save passwords when you log in to any website.
Experts warn against storing passwords in Chrome after hackers target remote workers. Hackers are preying on people working from home for passwords stored in web browsers, experts claim. Keeping passwords saved in the likes of Chrome and Edge is pretty common practice and usually considered quite safe.
You could use JQuery & Ajax to post the login form to the server and recieve a response back without ever reloading the page, thus avoiding this problem altogether.
EDIT
Something along the lines of this (untested):
<div id="error"></div>
<form id="loginForm" method="post">
<input type="username" name="username" id="username">
<input type="password" name="password" id="password">
<input type="submit" value="Login">
</form>
<script>
$(function(){
$('#loginForm').submit(function(){
// Ajax to check username/pass
$.ajax({
type: "POST"
, url: "/login"
, data: {
username: $('#username').val()
, password: $('#password').val()
}
, success: function(response) {
if(response == 'OK'){
$('#loginForm').submit()
} else {
$('#error').html('Invalid username or password')
}
}
})
})
</script>
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