IMetabasePasswordPolicy.CheckPassword

Syntax

CheckPassword(User: IMetabaseUser; NewPassword: String; OldPassword: String);

CheckPassword(Prognoz.Platform.Interop.Metabase.IMetabaseUser, System.String, System.String);

Parameters

User. User for whom the correctness of a new password is checked.

NewPassword. Password to be checked.

OldPassword. Old password that is used for comparison during check.

Description

The CheckPassword method validates user's new password for consistency according to the specified passwords policy in security manager. If password doesn't correspond to the specified passwords policy, an exception error is generated.

Example

To execute the example, add a link to the Metabase system assembly.

Sub UserProc;
Var
    Mb: IMetabase;
    Sec: IMetabaseSecurity;
    User: IMetabaseUser;
Begin
    Mb := MetabaseClass.Active;
    Sec := Mb.Security;
    User := Sec.Users.Item(
0);
    Sec.Policy.PasswordPolicy.CheckPassword(User, 
"qwe""qwr");
End Sub UserProc;

Imports Prognoz.Platform.Interop.Metabase;

Public Shared Sub Main(Params : StartParams);
Var
    Mb: IMetabase;
    Sec: IMetabaseSecurity;
    User: IMetabaseUser;
Begin
    Mb := Params.Metabase;
    Sec := Mb.Security;
    User := Sec.Users.Item[
0];
    Sec.Policy.PasswordPolicy.CheckPassword(User, 
"qwe""qwr");
End Sub;

After executing the example if a restriction for a minimum difference of old password from a new one for more than one character is set in passwords policy, an exception error is generated.

See also:

IMetabasePasswordPolicy