Logon - method of the Pm object
Description:
Login of the local user without the input window.
Syntax:
Long Logon(String sName, String sPassword)
Parameters:
sName | (String) Login name (name, not identifier) of the local user |
sPassword | (String) Login password of the local user |
---|
Return value:
0 - Login succesfull.
1 - User not registered, log in failed.
2 - Password incorrect, log in failed.
-1 - Missing parameters, log in failed.
Note:
Registering by the
Logon method rather skips the logon window of the local user, but then the normal login process proceeds and it is equal to registering by the login window. It means that the entered information are compared with the list of users and then triggering the
PmaRoot.onUserLogonBegin event follows with default parameters. Only after that it is decided whether the login process of the local user passed.
This method is also functional in
Web panels. User login on the Web cannot be competed without the user confirming the login and therefore this method does the same thing as the
Pm.WndLogon method - opens new user login window (the parameters
sName and
sPassword are not used).
In order to make the method correctly functional in the
Web panel, it is necessary to configure the panel (
PmaPanel object) to have the "
WebRead" permission (to force the network user to login into the browser). It is also recommended check the "
Strict mode of network users login into the application requiring the use of both name and password" configurator in the
PmaWeb object.
Example:
JavaScriptVBScriptSelect and copy to clipboard
var nLogon = Pm.Logon("admin", "xyz");
Pm.Debug("Logon=" + nLogon);
Dim nLogon
nLogon = Pm.Logon("admin", "xyz")
Pm.Debug "Logon=" & nLogon