I followed the tutorial [1] to build a user registeration and worked fine. Now I am trying to add feature such that when the user insert wrong username or password for three times, s/he will be blocked.
What I've tried is as follows:
1) LSV at login page load (errorCount)
2) In login_service, at "error" event, I've added:
alert("Incorrect username or password");
if (localStorage.getItem("errorCount") = 3){
alert("account is blocked!");}
localStorage.setItem("errorCount", errorCount++);
3) "success" event:
if (localStorage.getItem("errorCount") = 3){
alert("account is blocked!");}
else if (localStorage.getItem("accepted") !== "true")
{Apperyio.navigateTo("dg110_Disclaimer"); }
else {Apperyio.navigateTo("pg200_HomePage");}
However, no matter how many times the user insert wrong password, the message of "account is locked" is not showing and the user still can try again and again. I've used Weinre debugging and found "errorCount" remains zero. Is there anything wrong with my logic above? I deeply appreciate your help