Page 1 of 2
Problem with the concept
Posted: Wed Jan 22, 2014 4:50 am
by Ashok
Hey,
I recently started to make a Login Validation and I am using parse as a backend....i have a username and passwords which a new user will register through first time... on success it will navigate to the dashboard.... if there is error in the login process a error is displayed saying Invalid USername and Password.....i want to perform a function which will limit the errors to 5 times after which they wont be able to login for the next half an hour.
Can anyone give me a solution how this can be achieved?
Problem with the concept
Posted: Wed Jan 22, 2014 4:52 am
by maxkatz
You need to count logins and check against that number every time the user tries to login. This will be implemented in JavaScript. You could store the counter in local storage for example. You could also store it in Parse database.
Problem with the concept
Posted: Thu Jan 23, 2014 4:22 am
by Ashok
Ok now please help me with the following questions...
i Have a local Storage Variable which On error of login i want its value to increment to 1 ...2 ....3
and on 3 i want to disable the button for the next half an hour ...... i need to disable the logging In button for a amount of time what is the syntax i can use for that? and after that half an hour i need the Ui of the button to come back to its normal state....
Please Help me out with the above 2 problem?
Problem with the concept
Posted: Thu Jan 23, 2014 4:50 am
by Igor
You need to add Increment variable JS code on service error handle :
http://docs.appery.io/documentation/r...
http://stackoverflow.com/questions/83...
Disable button:
pre
code
var v =localStorage.getItem("localStorageVariableName");
if (v==3) {
Appery("mobilebutton_11").addClass('ui-disabled');
}
/code/pre
where mobilebutton_11 - button component name.
Problem with the concept
Posted: Thu Jan 23, 2014 4:54 am
by Ashok
if i want the button to be disabled for only 30 mins how do i set the timer? and after that 30 mins i want it to come back to its normal state? cud u pls help me?
Problem with the concept
Posted: Thu Jan 23, 2014 5:32 am
by Igor
code
setTimeout(function(){Appery("mobilebutton_11").removeClass('ui-disabled');}, 1800000);
/code
Problem with the concept
Posted: Thu Jan 23, 2014 7:06 am
by Ashok
Last doubt if i were to increment a value of the local storage on every unsucessful login how can i do that?
Problem with the concept
Posted: Thu Jan 23, 2014 8:13 am
by Kateryna Grynko
Hi Ashok,
Here is the code for you:prevar v =localStorage.getItem("localStorageVariableName"),
MINUTES = 3;
if (v==3) {
Appery("mobilebutton_11").addClass('ui-disabled');
setTimeout( function(){
Appery("mobilebutton_11").removeClass('ui-disabled');
localStorage.setItem("localStorageVariableName", 0)
}, 1000 * (60 * MINUTES));
return;
} else {
localStorage.setItem("localStorageVariableName", ++v);
}
// login action.../pre
Problem with the concept
Posted: Sat Jan 25, 2014 6:17 am
by Ashok
Thanks Katya,
it worked for me..... but i now need a solution for another problem, Can u please help me out with a detailed solution.,....
I have completed a app that would take a verse every 365 days of the year and display it on the app for this i am using APi calls from Parse to retrieve them ie(ONLINE)
now the client needs it to be in offline mode....
i have implemented the generic service that would sync the parse Db with the local Sq lite DB on load of the page i am calling this generic Service....
but now to make it completely offline i can syc the DB on first run of the app...
The problems i am facing are as follows:
- Now since i am calling the generic Service on load.. Everytime i open the app it sycs the data with parse Db.... Give me a solution how it shud work only once ie on first load itself..and then after that when ever the app loads i dont want it to sync.... is it possible?
Please help me with the code if necessary...
2.After SYncing once.... after using the app and then if the user closes the app..ie deletes it from the task manager and reopens it...will the synced content still be available...?
3.Or other than using a sync service to put it onto the Web SQl lite DB is there any other solution to make all the values from parse synced and then make calls offline?
Problem with the concept
Posted: Sun Jan 26, 2014 4:43 am
by Ashok
Please som1 help me with this problem........I havent got any Response since posting