Expressions/Scripts/Presets

Moderator: Paul Tuersley

 
bkan
Topic Author
Posts: 51
Joined: Wed Nov 06, 2013 8:33 am

Script protected with password

Fri Jun 26, 2015 8:23 am

Hello,
I'm trying to protect my script with a password. I want to launch a "prompt function " before starting my script to ask the user a password.
I have tried this :
doRun = true;
var champLicense = "trial";
var goodCode = "aftershine";
var check;
function affichePrompt(){
check = prompt("Rentrer votre code",champLicense,"Bienvenue");
return checkCode();
}

function checkCode(){
if(check==goodCode){
alert("good");
}
else{
alert("bad");
affichePrompt();
}
}
affichePrompt();

My only problem : when I hit "cancel", the "prompt window" does not disappear because I'm in the "else" answer : do you know how I can do??

And another question : i did not find anything on the web to protect my script with an encode password or something secured : have you got any idea where I can find some information?

Thanks in advance! (sorry for my bad english!)
 
bkan
Topic Author
Posts: 51
Joined: Wed Nov 06, 2013 8:33 am

Re: Script protected with password

Fri Jun 26, 2015 8:38 am

Ok sorry I found a solution! It is :
function checkCode(){
if(check==null){
}
else{
if(check==goodCode){
app.settings.saveSetting("AK_toolkit", "password","ok");
alert("Registration Successful\nThank you for purchasing AK toolkit!");
myScript(this);
}
else{
alert("Sorry, the registration code is not valid\n\nIf you require assistance please contact jsmartin@azarek.com");
affichePrompt();
}
}
}

Happy if it could help!

Who is online

Users browsing this forum: No registered users and 12 guests