Ibm mobilefirst worklight中的登录身份验证
我提到了这个问题,我已经阅读了所有的PDF文件,但我的登录仍然不起作用。我使用了另一种方法来检查数据库Ibm mobilefirst worklight中的登录身份验证,ibm-mobilefirst,worklight-adapters,worklight-studio,Ibm Mobilefirst,Worklight Adapters,Worklight Studio,我提到了这个问题,我已经阅读了所有的PDF文件,但我的登录仍然不起作用。我使用了另一种方法来检查数据库 var procedure1Statement = WL.Server.createSQLStatement("select t_id from teacher where t_id=? and t_password=?"); var response; function login(id,pass) { response= WL.Server.invoke
var procedure1Statement = WL.Server.createSQLStatement("select t_id from teacher where
t_id=? and t_password=?");
var response;
function login(id,pass) {
response= WL.Server.invokeSQLStatement({
preparedStatement : procedure1Statement,
parameters : [id,pass]});
return response;
}
function submitAuthentication(id, pass){
var invocationData={
adapter : "admin",
procedure : " login",
parameters : [id,pass],
};
var result=WL.Server.invokeProcedure (invocationData);
if(result.t_id >1 )
{
var userIdentity = {
userId : id,
displayName : id,
attributes: {
role: "admin"
}
};
WL.Server.setActiveUser("adminRealm",userIdentity);
return{
authRequired : false
};
}
return onAuthRequired(null,"Invalid Login Credentials");
}
function onLogout(){
WL.Logger.debug("Logged Out");
}
我应该在这里使用什么条件使它工作
if(result.t_id >1 )
或者,再加上你想对返回的记录进行的任何其他检查
if (result.resultSet.length == 1 && result.resultSet[0].t_id > 0)
顺便说一句:
在过程名称之前,调用数据中有一个多余的空格:
procedure : " login",
procedure : " login",