IMetabaseUser.ChangePassword

Syntax

ChangePassword(OldPassword: String; NewPassword: String);

Parameters

OldPassword. An old password.

NewPassword. A new password.

Description

The ChangePassword method changes the user password.

Comments

The user who has the "Change of users rights, distribution of passwords, change of policy" privilege, can change the password of another user. ADMIN has this privilege by default. If the password is changed for another user, the empty value is passed as OldPassword. If the new password does not satisfy the requirements of the set security policy, the exception condition is generated. Depending on the settings of the password policy, the old user password can be used to provide the password history. The password can not be changed for the domain user. After change of the password the window of authorization on the server will be shown for the user that is connected from the server.

Example

Executing the example requires the EditBox1 component positioned on the form.

Sub UserProc;

Var

MB: IMetabase;

User: IMetabaseUser;

MS: IMetabaseSecurity;

Begin

MB := MetabaseClass.Active;

MS := MB.Security;

User := MS.ResolveName("User1") As IMetabaseUser;

Try

User.ChangePassword("",EditBox1.Text);

Except

On E: Exception Do

WinApplication.InformationBox(E.message);

End Try;

End Sub UserProc;

The current connection is done from the administrator profile. After executing the example the password of the set user is changed. If the new password does not satisfy the requirements of the security policy, the appropriate message is shown.

See also:

IMetabaseUser