SetPassword

The function SetPassword sets a new password for a specified user in your project’s security system.

Function Group Execution Windows Embedded Thin Client Mobile Access
SetPassword Security Synchronous Supported Supported Supported Not supported

Syntax

  SetPassword(optStrUserName,optStrNewPassword,optStrConfirmPassword,optStrCurrentPassword)  
Web Studio Help ctions security setpassword.xml d422420e112 SetPassword

optStrUserName
The name of the user.

This is an optional parameter; if no value is specified, a dialog box will be displayed on the client so that the current user can select the name.

optStrNewPassword
The new password for the specified user.

This is an optional parameter; if no value is specified, a dialog box will be displayed on the client so that the current user can type the password.

optStrConfirmPassword
The new password again, to confirm that it has been typed correctly.

This is an optional parameter; if no value is specified, a dialog box will be displayed on the client so that the current user can type the password.

optStrCurrentPassword
The current password for the specified user, to authorize the change.

This is an optional parameter; if no value is specified, a dialog box will be displayed on the client so that the current user can type the password.

Returned value

This function returns the following possible values:
Value Description
-1000 Could not display dialog box, because the function was called on the project runtime server. The function should be called on the client.
-1 Internal error. Please contact Customer Support.
0 Password set successfully.
1 Invalid number of parameters.
2 Wrong parameter type.
3 The specified user does not exist.
4 Reentrant call not allowed.
5 User clicked Cancel in the Set Password dialog box.
6 The specified group does not exist.
7 The specified password is too weak.
8 Invalid password.
9 Invalid user.
10 The current user does not have sufficient privileges to set user passwords (i.e., the current user does not have the option Edit Security System selected in the Security System settings).
11 Server offline.
12 Communication error (e.g., the function was called on remote client that cannot communicate with the LDAP server).
13 Confirmation does not match new password.
14 Set Password dialog box is already displayed, cannot display another dialog box. (For example, if the user clicked OK without providing all of the required information.)
15 The current security mode does not allow user passwords to be changed.

Notes

If you do not want the dialog box to be displayed on the client, you must provide all four paramaters to the function. Otherwise, the dialog box will be displayed in order to get the remaining information from the current user.

Examples

Display the Set Password dialog box on the client, to get the information from the current user:
  SetPassword()  
Change the password for user “Admin”, but display the dialog box in order to get the new password and authorization:
  SetPassword("Admin")  
Change the password for user “admin” to the value of the tag newPassword, but display the dialog box in order to get authorization:
  SetPassword("Admin",newPassword,newPassword)  
Change the password for user “admin” to the value of the tag newPassword, without displaying the dialog box:
  SetPassword("Admin",newPassword,newPassword,"DLfVU89Y")  

SetPassword