I’m trying to use the checkPassword, and getting the following error:
org.mozilla.javascript.EvaluatorException: Can’t find method com.servoy.j2db.scripting.JSSecurity.js_checkPassword(string,string). (actAppUpdateUser, line 21)
From the message, it seems as though something’s wrong with my installation, but perhaps it’s just in the way I’ve used the command?
Scenario:
Below is the full method. I’m setting up security management in the user interface, so that the client can set up users and groups in Servoy Client (although finer security, such as table-level access, will have to be administered from Developer).
The method below is triggered when the user name field is edited. It either creates or updates the user name. For new users, the password is set to the userid by default. For changes, if the password is still = the user name, the password should be updated, too, else left alone.
currentcontroller.saveData();
if ( userid_cached != userid && security.getUserId(userid))
{
plugins.dialogs.showErrorDialog( 'Duplicate User ID', 'This UserID is already in use. Please enter another.');
userid = userid_cached;
return;
}
if (!userid)
{
userid = userid_cached
return;
}
if ( !userid_cached )
{
security.createUser(userid,userid);
id = security.getUserId(userid)
}
else
{
if (security.checkPassword(id, userid_cached))
{
security.setPassword(id, userid);
}
security.changeUserName(id, userid);
}
userid_cached = userid;