I'm working on a project where I use jQuery Terminal for a command line interface to functions.
I've been trying to use it's built in authentication capability, but want it to call a JavaScript function to obtain authentication and not calling PHP.
Do you happen to have an example of JQuery Terminal that calls a JavaScript authentication function, not a PHP function?
The documentation says:
You can provide your authentication function which will be called when user enter login and password. Function must have 3 arguments first is user name, second his password and third is callback function which must be called with token or null if user enter wrong user and password.
Been trying to get it to work without much luck....
jQuery(document).ready(function($)
{
var userName = "";
var password = "";
$('#term_demo').terminal(
test1(
userName,
password,
callbackFunction1() {
alert("Your login is incorrect");
},
{
login: true,
greetings: "You are authenticated"
}
);
});
function test1(name1, password1, callbackFunction1)
{
if(name1 == "Derek")
{
return true;
}
else
{
return false;
}
}
function callbackFunction1()
{
alert("Invalid user name and password");
}
Let me know if you have any suggestions or a simple example to get me going again...