ChangeUserPassword - Change your own password ResetPassword - Change another user's password |
These routines enable you to change a password for yourself or for another user.
ChangeUserPassword |
Change your own password. The new password must comply with the Password Policy set up in the MACRO System Management module and will be rejected if it does not.
If a new user tries to log in before having reset their temporary password, they will be prompted to change it. Currently this initial password change for a new user can only be done by logging into a MACRO module. Subsequent password changes can be done via the API.
Input
Ensure all text parameters conform to these formatting rules.
Parameter |
Description |
user |
Currently logged-in user as returned from Login |
newPassword |
Your new password |
oldPassword |
Your old password |
public static bool ChangeUserPassword(ref UserProperties user, string newPassword, string oldPassword, ref string message) |
Output
· True or False - indicating success or failure
· message - if the new password is invalid, an error message describes the reason
ResetPassword |
Change another user's password. The new password must comply with the Password Policy set up in the MACRO System Management module and will be rejected if it does not. The API user must be assigned the 'Reset Password' permission in order to carry out this task.
Input
Ensure all text parameters conform to these formatting rules.
Parameter |
Description |
user |
Currently logged-in user as returned from Login |
userName |
User name for whom the password is to be reset |
newPassword |
New password |
public static PasswordResult ResetPassword(ref UserProperties user, string userName, string newPassword, ref string message) |
Output
· Return code indicating success or nature of failure (see below)
· message - if the new password is invalid, an error message describes the reason
The ResetPassword routine returns an integer code as type PasswordResult indicating the overall result, as listed in the table below:
Code |
Value |
Description |
0 |
Success |
The operation was successful |
1 |
AccountDisabled |
The target user has been disabled or locked out of MACRO |
2 |
UnknownUser |
The target user does not exist |
3 |
InvalidPassword |
Password is not valid according to the current Password Policy settings |
4 |
PermissionDenied |
The currently logged-in user does not have the ResetPassword permission or a non-system administrator is trying to reset the password of a system administrator |
5 |
Error |
An unknown error occurred |