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

UserPassword

Not available for a Windows user.

Changes the password for the user. Changes are written to both the Users database and the runtime database in memory.

An alarm server needs to be configured and running in the project, so that all clients are notified that an online change to the users configuration has been completed.

If you use this function to perform user configuration changes across an online system with multiple computers running SCADA nodes, you will need to use the [CtEdit]Run[CtEdit]Run and [CtEdit]Copy[CtEdit]Copy parameters to distribute the updated files throughout the system.

You will also need to execute the UserPassword function on:

UserPassword can only work for users that are contained in the main project.

Note: Only those users assigned a role with "Manage User" privilege set to True can set a user password without knowing the existing password. Other users attempting to run will encounter an error.

This function is a blocking function. It blocks the calling Cicode task until the operation is complete.

Syntax

UserPassword(sName [, sPassword] [, sOldPassword] )

sName:

The name of the user.

sPassword:

The password of the user.

The sPassword argument is optional. If not passed, this argument defaults to an empty string which is subsequently ignored. It is included for the purposes of handling duplicate user names and separate password identification compatibility.

sOldPassword:

The password assigned to the user before the UserPassword() function is run.

The sOldPassword argument is optional. If passed, Citect SCADA will only permit the password change (and consequent re-setting of the expiry period) when the old password is correctly entered. If the sOldPassword parameter is not passed, the password change will proceed without restriction.

Return Value

0 (zero) if successful, otherwise an error code is returned.

Related Functions

UserPasswordForm, UserCreate, UserEditForm

Example

/* Change Fred's password */
UserPassword("Fred", "secret");

See Also

Security Functions

Published June 2018