Occurs when a password is changed or is reset.

Namespace:  Novalys.VisualGuard.Security
Assembly:  Novalys.VisualGuard.Security (in Novalys.VisualGuard.Security.dll) Version: 3.2.912.1 (3.2.912.01)

Syntax

C#
public static event VGValidatePasswordEventHandler ValidatingPassword
Visual Basic (Declaration)
Public Shared Event ValidatingPassword As VGValidatePasswordEventHandler

Remarks

The event handler receives an argument of type VGValidatePasswordEventArgs containing data related to this event. The ValidatingPassword event allows to cancel the password modification when the password is not valid.

Examples

This example show a ValidatingPassword event that checks whether the password does not contain a list of invalid string.
CopyVB.NET
Private Sub OnValidatingPassword(ByVal sender As Object, ByVal e As VGValidatePasswordEventArgs)
   Dim invalidText() As String = New String() {"password", "novalys", "aaa", "bbb", "ccc"}
   For Each text As String In invalidText
       If e.Password.IndexOf(text, StringComparison.CurrentCultureIgnoreCase) >= 0 Then
           e.Cancel = True
           Return
       End If
   Next
   If e.Password.IndexOf(e.UserName, StringComparison.CurrentCultureIgnoreCase) >= 0 Then
       e.Cancel = True
   End If
End Sub
CopyC#
private void OnValidatingPassword (object sender, VGValidatePasswordEventArgs args)
{
    string[] invalidText = new string[] { "pwd", "password", "passwd", "aaa", "bbb" };
    foreach (string text in invalidText)
    {
        if (e.Password.IndexOf(text, StringComparison.CurrentCultureIgnoreCase) >= 0 
        {
            e.Cancel = true;
            return;
        }
    }
    if (e.Password.IndexOf(e.UserName, StringComparison.CurrentCultureIgnoreCase) >= 0)
    {
       e.Cancel = true;
    }
}

See Also