Occurs when a password is changed or is reset.

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

Syntax

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

Value

Type: Novalys.VisualGuard.Security..::..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.
Visual Basic Copy imageCopy
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
C# Copy imageCopy
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