Applies To: |
|
Summary: |
I would like to test privileges, and need a way to login different users quickly. Is there a function to do this? |
Solution: |
This function below can be called from a
keyboard command. For example, you could set up each function key
to log in a different user. Pass in the user/password into the
command of the keyboard command definition. The first command in
this function logs out the last user. INT FUNCTION myLoginForm(STRING sName="", STRING sPassword="") INT nStatus=-1; INT hForm; Logout(); hForm=FormNew("@(Login Form)", 35, 5, 5); FormPrompt(1, 0, "@(Name)"); FormInput(16, 0, "", sName, 16); FormPrompt(1, 2, "@(Password)"); FormSecurePassword(18, 2, "", sPassword, 16); FormButton( 6, 4, " " + "@(OK)" + " ", 0, 1); FormButton(20, 4, "@(Cancel)", 0, 2); SleepMS(200); IF FormRead(1) = 0 THEN SleepMS(300); FormGetData(hForm); IF UserLogin(sName, sPassword) = 0 THEN nStatus = 0; ELSE sPassword = ""; END IF FormActive(hForm) THEN FormDestroy(hForm); END ELSE nStatus = 298; END RETURN nStatus; END |
Keywords: |
automatic login |
Related Links
Attachments