Click or drag to resize

VGSecurityManagerValidatingPassword Event

Occurs when a password is changed or is reset.

Namespace:  Novalys.VisualGuard.Security
Assembly:  Novalys.VisualGuard.Security (in Novalys.VisualGuard.Security.dll) Version: 2019.1.831.19 (2019.1.0831.19)
Syntax
public static event VGValidatePasswordEventHandler ValidatingPassword

Value

Type: Novalys.VisualGuard.SecurityVGValidatePasswordEventHandler
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.
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