I want to count the maximum number of login attempts in javascript. I really doubt we can do it in javascript because every time I submit the form it will give me a new instance of JS file and variables inside. So the previous login counter will be lost on the next form submission. Is there a way we can limit the max login attempts to 3?
I want to count the maximum number of login attempts in javascript. I really doubt we can do it in javascript because every time I submit the form it will give me a new instance of JS file and variables inside. So the previous login counter will be lost on the next form submission. Is there a way we can limit the max login attempts to 3?
Share Improve this question edited Feb 22, 2012 at 9:59 zeroos 2,2243 gold badges18 silver badges24 bronze badges asked Feb 22, 2012 at 9:49 M SachM Sach 34.4k78 gold badges230 silver badges317 bronze badges 1- 5 Java != JavaScript. And no, do not use JavaScript for limiting login attempts. – Rob W Commented Feb 22, 2012 at 9:49
3 Answers
Reset to default 6You can use localStorage
, cookies or a hidden input element to keep track of the number of login attempts (remember the dates of the last three login attempts, and pare the dates with the current time).
However, do not rely on JavaScript for this purpose, as it's easy to circumvent this.
Given that you will submit the page every time ok/submit button is clicked, there is no point doing this is javascript. If however you were checking the password in javascript it would make sense. Having said that, checking passwords in javascript is unsafe.
There are ways to do this but everything you save on the client side is insecure since the client can change the data (or even remove your counter so it restarts counting).
If you have a critical/sensitive application you should manage the login-attemps, and all other forms of login data you which to have, server-side where you control the content.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745218463a4617134.html
评论列表(0条)