Yes, you do have to quit out of Servoy to “change” users. Why? Because Servoy will cache the last login info and (trying to be helpful) will try it when a solution requires login (to save you from having to type the same stuff over and over again).
currently not.
And it will also be a bit tricky because when you do logoff and the solution you are looking at needs a login, The solution will be closed.
so i can make a application.logOff() method but that one can also be closing the solution.
(1) show a login page with two global fields for user name and user password.
(2) set your security up as you would normally but don’t require security to open the solution. then take the user to your custom login page on start up.
(3) run this code after the user fills out the two fields:
var ID = security.getUserId(globals.g_user);
var check = security.checkPassword(ID, globals.g_password);
if (check)
{
forms.main_client_list.controller.show();
}
else
{
plugins.dialogs.showErrorDialog('Error', 'Login incorrect','OK');
}
(4) to “logout”, simply send the user to the login page and clear the two globals. of course you will need to set all forms to non visible so that filling in this login page is the only way into your solution.
what is idle?
And when do you get this info? Because at the moment you get this info (in a method) the user is doing something. Or you have to test this with the scheduler plugin..
That is what I thought about: checking for example every five minutes if the solution has been idle for the last 30 minutes. But probably checking something makes the solution “un-idle”?
(1) show a login page with two global fields for user name and user password.
(2) set your security up as you would normally but don’t require security to open the solution. then take the user to your custom login page on start up.
(3) run this code after the user fills out the two fields:
var ID = security.getUserId(globals.g_user);
var check = security.checkPassword(ID, globals.g_password);
you have to fill with globals.g_user = security.getUser() (or something like that) But then the users have to login (solution requires a login see security dialog) so that there is a user.
Trying to help FreeColours with his problem, I notices that the sample code for security.getUserId( [username]) doen’t show how to use the security.getUserId( [username]) function…
Same goes for security.getUserName( [user_id])
As for your issue FreeColour: I think that what jcompager means is that is seems that var ID holds no value and therefor security.checkPassword(ID, globals.g_password); gives an error.
You do not check if the username the user filled in actually exists. If it doesn’t exists, the ID will be empty.