PasswordHistory: IPasswordHistory;
The PasswordHistory property returns the user passwords history.
Executing this example requires a form, a button named Button1 positioned on this form, the EditBox component named EditBox1 and the Memo component named Memo1. The example is executed on clicking the button.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Mb: IMetabase;
MbUser: IMetabaseUser;
MbSecurity: IMetabaseSecurity;
HashP: String;
MbPassHistory: IPasswordHistory;
Begin
Mb := MetabaseClass.Active;
MbSecurity := Mb.Security;
MbUser := MbSecurity.ResolveName("ADMIN") As IMetabaseUser;
HashP := MbSecurity.HashPassword(EditBox1.Text);
MbPassHistory := MbUser.PasswordHistory;
If MbPassHistory.Contains(HashP) Then
Memo1.Lines.Add("Password '" + EditBox1.Text + "' is already in history");
Else MbPassHistory.Insert(HashP);
Memo1.Lines.Add("Password '" + EditBox1.Text + "' is added in history");
End If;
MbSecurity.Apply;
End Sub Button1OnClick;
After executing this example the password entered into the EditBoxcomponent is checked to find whether it occurred in password history. The results of checking are displayed in the component Memo.
See also: