Cicode Programming Reference > Cicode Function Categories > Security Functions > Login

Login

Not available when logged in as Windows user.

Logs a user into the Citect SCADA system, using Citect SCADA security and gives users access to the areas and privileges assigned to them in the Users database, and uses the locale language defined for that user. Only one user can be logged into a computer at any one time. If a user is already logged in when a second user logs in, the first user is automatically logged out.

When using Windows security use UserLogin to limit Windows credentials being exposed as plain text.

At startup, or when the user logs out, a default user is active, with access to area 0 (zero) and privilege 0 (zero) only. Use the LoginForm() function to display a form for logging in to the system.

Syntax

Login(sUserName, sPassword [, bSync][, sLanguage])

sUserName:

The user's name, as defined in the Users database.

sPassword:

The user's password, as defined in the Users database.

bSync:  

Optionally specifies whether the function operates in blocking or non-blocking mode. If set to 1 blocks caller until login is complete. If set to 0 (default) does not block caller.

sLanguage:

The specified language needs to be one of the languages defined in System/Languages (LANG.DBF). If the specified language is undefined, the default language is used by the login user, and a message "Undefined language" is shown in the prompt line.

An empty string (i.e. "") can be specified to indicate that the default language is used by the login user. The default language defined by [Language]LocalLanguage INI parameter.

The default value of this parameter is "".

Return Value

0 (zero) if successful.

Related Functions

LoginForm, Logout, LogoutIdle, Message, Input, UserLogin

Example

/*  
** Log in a user whose user name is "FRED" and whose password
** is "ABC". 
** 
** The language of the logged in user session will be set to
** the default language.
*/
Login("FRED", "ABC");

/*  
** Log in a user whose user name is "FRED" and whose password
** is "ABC". 
** 
** The language of the logged in user session will be set to
** English.
*/
Login("FRED", "ABC", 0, "English");
				
/*  
** Log in a user whose user name is "FRED" and whose password
** is "ABC". 
** 
** The language of the logged in user session will be set to
** French.
*/
Login("FRED", "ABC", 0, "French(France)");
				
/*  
** Log in a user whose user name is "FRED" and whose password
** is "ABC". 
** 
** The language of the logged in user session will be set to
** Chinese.
*/
Login("FRED", "ABC", 0, "Chinese(Simplified, PRC)");
				

        

See Also

Security Functions

Published June 2018