Hi!
Does anybody have an example for a simple js loginscript without a DB with the jquery input Fields? Users can be "hardcoded", no registration.
Hi!
Does anybody have an example for a simple js loginscript without a DB with the jquery input Fields? Users can be "hardcoded", no registration.
Hello Lars,
Sure, it is possible to do with a Storage variables, which have a list of users, or use hard-cored array, which you can check with a condition like:
prefor(var i = 0; i< users.length; i++){
if((Apperyio("username").val() === users.name)&&(Apperyio("password").val() === users.password)){
alert("signed in");
break;
}
}/pre
here username and password - names of input fields in your app
users - an array of objects with names and passwords
"
"
This also serves the purpose, but how do i convert it to work with a a button made in appery?
function passWord() {
var testV = 1;
var pass1 = prompt('Please Enter Your Password',' ');
while (testV < 3) {
if (!pass1)
history.go(-1);
if (pass1.toLowerCase() == "letmein") {
alert('You Got it Right!');
window.open('protectpage.html');
break;
}
testV+=1;
var pass1 =
prompt('Access Denied - Password Incorrect, Please Try Again.','Password');
}
if (pass1.toLowerCase()!="password" & testV ==3)
history.go(-1);
return " ";
}
http://www.javascriptkit.com/script/c...
This would cover what im after, i just need to make it work with "on click" - javascript one of my buttons made in the app?
Ok, i got a form that worked:
'
'
This works with 2 input fields in the appery editor. The only thing i cant get to work is the buttons.. In the HTML form here, it makes its own button- but i want to make my own. How would that JS code be different from this html one "on click"?
Please add a new property "page" into the array users and compare it with the current page:
prevar currentPage = $(".ui-page-active").attr("id");
if (users.page === currentPage){
alert("Curren page is available!");
}/pre